feat: split off outputs
This commit is contained in:
parent
7f094b80c5
commit
dc411c006e
5 changed files with 52 additions and 65 deletions
60
flake.nix
60
flake.nix
|
@ -1,9 +1,5 @@
|
|||
{
|
||||
######
|
||||
inputs = {
|
||||
######
|
||||
#nixpkgs-old.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||
|
||||
# Main nix package repository
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
|
@ -28,59 +24,5 @@
|
|||
nix-flatpak.url = "github:gmodena/nix-flatpak";
|
||||
};
|
||||
|
||||
#######
|
||||
outputs =
|
||||
#######
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixos-hardware,
|
||||
nixos-unstable,
|
||||
nix-flatpak,
|
||||
home-manager,
|
||||
nixos-generators,
|
||||
...
|
||||
} @ inputs: let
|
||||
# Supported systems for your flake packages, shell, etc.
|
||||
systems = [
|
||||
#"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
# This is a function that generates an attribute by calling a function you
|
||||
# pass to it, with each system as an argument
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
|
||||
host_helper = hostname: {
|
||||
${hostname} = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {inherit inputs;};
|
||||
modules = [
|
||||
./hosts/${hostname}
|
||||
];
|
||||
};
|
||||
};
|
||||
in {
|
||||
# Your custom packages
|
||||
# Accessible through 'nix build', 'nix shell', etc
|
||||
#packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
||||
|
||||
# Formatter for your nix files, available through 'nix fmt'
|
||||
# Other options beside 'alejandra' include 'nixpkgs-fmt'
|
||||
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
|
||||
|
||||
# Your custom packages and modifications, exported as overlays
|
||||
overlays = import ./overlays {inherit inputs;};
|
||||
|
||||
# Reusable nixos modules you might want to export
|
||||
# These are usually stuff you would upstream into nixpkgs
|
||||
#nixosModules = import ./modules/nixos;
|
||||
|
||||
# NixOS configuration entrypoint
|
||||
# Available through 'nixos-rebuild --flake .#your-hostname'
|
||||
# to add more append // (host_helper example);
|
||||
nixosConfigurations =
|
||||
host_helper "crocoite" //
|
||||
host_helper "jitsi";
|
||||
|
||||
};
|
||||
outputs = {...}@inArgs: import ./outputs.nix inArgs;
|
||||
}
|
||||
|
|
9
hostHelper.nix
Normal file
9
hostHelper.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
inArgs: hostname: {
|
||||
${hostname} = inArgs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {inherit inArgs;};
|
||||
modules = [
|
||||
{networking.hostName = hostname;}
|
||||
(./hosts/${hostname})
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
inArgs,
|
||||
modulesPath,
|
||||
nixos-unstable,
|
||||
...
|
||||
}: {
|
||||
networking.hostName = "crocoite"; # Define your hostname.
|
||||
#networking.hostName = "crocoite"; # Define your hostname.
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
|
@ -18,7 +18,7 @@
|
|||
#nixpkgs.overlays = [ overlays.unstable-packages ];
|
||||
nixpkgs = {
|
||||
# You can add overlays here
|
||||
overlays = with inputs.self.overlays; [
|
||||
overlays = with inArgs.self.overlays; [
|
||||
# Add overlays your own flake exports (from overlays and pkgs dir):
|
||||
#additions
|
||||
#modifications
|
||||
|
@ -56,7 +56,7 @@
|
|||
# steam and other stuff seems to depend on perl
|
||||
#"${modulesPath}/profiles/perlless.nix"
|
||||
|
||||
inputs.nix-flatpak.nixosModules.nix-flatpak
|
||||
inArgs.nix-flatpak.nixosModules.nix-flatpak
|
||||
|
||||
#nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1
|
||||
./hardware-configuration.nix
|
||||
|
|
36
outputs.nix
Normal file
36
outputs.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
inArgs: let
|
||||
# Supported systems for your flake packages, shell, etc.
|
||||
systems = [
|
||||
#"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
# This is a function that generates an attribute by calling a function you
|
||||
# pass to it, with each system as an argument
|
||||
forAllSystems = inArgs.nixpkgs.lib.genAttrs systems;
|
||||
|
||||
hostHelper = import ./hostHelper.nix inArgs;
|
||||
|
||||
in {
|
||||
# NixOS configuration entrypoint
|
||||
# Available through 'nixos-rebuild --flake .#your-hostname'
|
||||
# to add more append // (host_helper example);
|
||||
|
||||
nixosConfigurations =
|
||||
(hostHelper "crocoite"); #// (host_helper2 "jitsi");
|
||||
|
||||
# Your custom packages
|
||||
# Accessible through 'nix build', 'nix shell', etc
|
||||
#packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
||||
|
||||
# Your custom packages and modifications, exported as overlays
|
||||
overlays = import ./overlays {inherit inArgs;};
|
||||
|
||||
# Reusable nixos modules you might want to export
|
||||
# These are usually stuff you would upstream into nixpkgs
|
||||
#nixosModules = import ./modules/nixos;
|
||||
|
||||
# Formatter for your nix files, available through 'nix fmt'
|
||||
# Other options beside 'alejandra' include 'nixpkgs-fmt'
|
||||
formatter = forAllSystems (system: inArgs.nixpkgs.legacyPackages.${system}.alejandra);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
# This file defines overlays
|
||||
{inputs, ...}: {
|
||||
{inArgs, ...}: {
|
||||
# This one brings our custom packages from the 'pkgs' directory
|
||||
additions = final: _prev: import ../pkgs final.pkgs;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
# When applied, the unstable nixpkgs set (declared in the flake inputs) will
|
||||
# be accessible through 'pkgs.unstable'
|
||||
unstable-packages = final: _prev: {
|
||||
unstable = import inputs.nixos-unstable {
|
||||
unstable = import inArgs.nixos-unstable {
|
||||
system = final.system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue