minimal version
This commit is contained in:
parent
dac127c67f
commit
836f05e7ea
|
@ -1,8 +1,12 @@
|
|||
# This file should hold stuff you use across all hosts
|
||||
{ inputs, pkgs, ... }: {
|
||||
imports = [
|
||||
# Add external nixos modules here
|
||||
# inputs.hardware.nixosModules.common-cpu-amd
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
system.stateVersion = "21.11";
|
||||
# Uncomment to enable unfree packages for your systems. You can also put this
|
||||
# on the specific host
|
||||
# Uncomment to enable unfree packages for your system
|
||||
# nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# This will make all users source .nix-profile on login, activating home
|
163
flake.nix
163
flake.nix
|
@ -14,121 +14,60 @@
|
|||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Other community flakes
|
||||
# Add any other flakes you need
|
||||
nur.url = "github:nix-community/NUR";
|
||||
impermanence.url = "github:riscadoa/impermanence";
|
||||
nix-colors.url = "github:misterio77/nix-colors";
|
||||
# Add any cool flakes you need
|
||||
# nur.url = "github:nix-community/NUR";
|
||||
# impermanence.url = "github:riscadoa/impermanence";
|
||||
# nix-colors.url = "github:misterio77/nix-colors";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, hardware, home-manager, nur, impermanence, nix-colors, utils }@inputs:
|
||||
outputs = { self, nixpkgs, home-manager, utils, ... }@inputs: {
|
||||
# Overlayed packages
|
||||
overlay = (import ./overlays.nix);
|
||||
|
||||
# This repos plus any other overlays you use
|
||||
# If you want to use out-of-nixpkgs-tree packages, add their overlays here.
|
||||
overlays = [ self.overlay nur.overlay ];
|
||||
|
||||
# System configurations
|
||||
# Accessible via 'nixos-rebuild --flake'
|
||||
nixosConfigurations = {
|
||||
cool-computer = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
./configuration.nix
|
||||
{ nixpkgs.overlays = self.overlays; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Home configurations
|
||||
# Accessible via 'home-manager --flake'
|
||||
homeConfigurations = {
|
||||
"you@cool-computer" = home-manager.lib.homeManagerConfiguration {
|
||||
system = "x86_64-linux";
|
||||
username = "you";
|
||||
homeDirectory = "/home/you";
|
||||
configuration = ./home.nix;
|
||||
extraModules = [{ nixpkgs.overlays = self.overlays; }];
|
||||
};
|
||||
};
|
||||
} // utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
# Utility for building a system configuration
|
||||
mkSystem = { hostname, system }:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
# Host configuration
|
||||
(./hosts + "/${hostname}")
|
||||
# Your custom modules
|
||||
./modules/nixos
|
||||
# Common stuff
|
||||
{
|
||||
# Add hostname
|
||||
networking.hostName = hostname;
|
||||
# Add your overlays to system config
|
||||
nixpkgs.overlays = self.overlays;
|
||||
# Add your flake inputs to system registry
|
||||
nix.registry = nixpkgs.lib.mapAttrs'
|
||||
(n: v:
|
||||
nixpkgs.lib.nameValuePair ("${n}") ({ flake = inputs."${n}"; })
|
||||
)
|
||||
inputs;
|
||||
}
|
||||
];
|
||||
};
|
||||
pkgs = import nixpkgs { inherit system; overlays = self.overlays; };
|
||||
hm = home-manager.defaultPackage."${system}";
|
||||
in
|
||||
{
|
||||
# Your custom packages, plus nixpkgs and overlayed stuff
|
||||
# Accessible via 'nix build .#example' or 'nix build .#nixpkgs.example'
|
||||
packages = {
|
||||
nixpkgs = pkgs;
|
||||
} // (import ./pkgs { inherit pkgs; });
|
||||
|
||||
# Utility for building a home configuration
|
||||
mkHome = { username, hostname, system }:
|
||||
home-manager.lib.homeManagerConfiguration {
|
||||
inherit username system;
|
||||
extraSpecialArgs = { inherit hostname inputs; };
|
||||
homeDirectory = "/home/${username}";
|
||||
configuration = ./home + "/${username}";
|
||||
extraModules = [
|
||||
# Your custom modules
|
||||
./modules/home-manager
|
||||
# Common stuff
|
||||
{
|
||||
# Add your overlays to home config
|
||||
nixpkgs.overlays = self.overlays;
|
||||
# Enable home-manager and git, needed for basic usage
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
git.enable = true;
|
||||
};
|
||||
# Update services as needed
|
||||
systemd.user.startServices = "sd-switch";
|
||||
}
|
||||
];
|
||||
};
|
||||
in {
|
||||
# Overlayed packages
|
||||
overlay = (import ./overlays);
|
||||
|
||||
# This repos plus any other overlays you use
|
||||
# If you want to use out-of-nixpkgs-tree packages, add their overlays here.
|
||||
overlays = [ self.overlay nur.overlay ];
|
||||
|
||||
# System configurations
|
||||
# Accessible via 'nixos-rebuild --flake'
|
||||
nixosConfigurations = {
|
||||
cool-computer = mkSystem {
|
||||
hostname = "cool-computer";
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
very-cool-computer = mkSystem {
|
||||
hostname = "very-cool-computer";
|
||||
system = "aarch64-linux";
|
||||
};
|
||||
# Devshell for bootstrapping plus editor utilities (fmt and LSP)
|
||||
# Accessible via 'nix develop'
|
||||
devShell = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ nix nixfmt rnix-lsp hm ];
|
||||
};
|
||||
|
||||
# Home configurations
|
||||
# Accessible via 'home-manager --flake'
|
||||
homeConfigurations = {
|
||||
"you@cool-computer" = mkHome {
|
||||
username = "you";
|
||||
hostname = "cool-computer";
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
"you@very-cool-computer" = mkHome {
|
||||
username = "you";
|
||||
hostname = "very-cool-computer";
|
||||
system = "aarch64-linux";
|
||||
};
|
||||
};
|
||||
|
||||
# Flakes templates you can access with 'nix flake init'
|
||||
templates = import ./templates;
|
||||
|
||||
} // utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; overlays = self.overlays; };
|
||||
hm = home-manager.defaultPackage."${system}";
|
||||
in {
|
||||
# Packages you can access with 'nix build'
|
||||
packages = {
|
||||
# Re-export nixpkgs' packages under the attribute "nixpkgs"
|
||||
# That way, you can test your overlays with 'nix build .#nixpkgs.package-name'
|
||||
nixpkgs = pkgs;
|
||||
# Export your custom packages. You can build them with 'nix build .#package-name'
|
||||
} // (import ./pkgs { inherit pkgs; });
|
||||
|
||||
# Devshell you can access with 'nix develop'
|
||||
# Has nix and home-manager for bootstrapping
|
||||
# plus formatter and LSP for a nice editor experience
|
||||
devShell = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ nix nixfmt rnix-lsp hm ];
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
8
home.nix
Normal file
8
home.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ inputs, pkgs, hostname, ... }: {
|
||||
imports = [
|
||||
# Add external home-manager modules here
|
||||
];
|
||||
|
||||
# Add stuff for your user as you see fit:
|
||||
# programs.neovim.enable = true;
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
{ inputs, pkgs, hostname, ... }: {
|
||||
imports = [
|
||||
# Split up your config into more files and import them here
|
||||
];
|
||||
|
||||
# Add stuff for your user as you see fit:
|
||||
# programs.neovim.enable = true;
|
||||
|
||||
# You can do stuff conditionally based on hostname, too:
|
||||
/*
|
||||
programs.alacritty = pkgs.lib.mkIf (hostname == "foo-bar") {
|
||||
enable = true;
|
||||
};
|
||||
*/
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{ inputs, pkgs, ... }: {
|
||||
imports = [
|
||||
../common
|
||||
# You can split your config up and import other files here
|
||||
# You should also take a look at nixos-hardware and import and needed modules, such as:
|
||||
# inputs.hardware.nixosModules.common-cpu-amd
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{ inputs, pkgs, ... }: {
|
||||
imports = [
|
||||
../common
|
||||
# You can split your config up and import other files here
|
||||
# You should also take a look at nixos-hardware and import and needed modules, such as:
|
||||
# inputs.hardware.nixosModules.common-cpu-amd
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
# This should be generated with nixos-generated-config
|
||||
{}
|
|
@ -1,6 +0,0 @@
|
|||
# Add your custom home-manager modules to this folder, then import them here.
|
||||
{
|
||||
imports = [
|
||||
# ./example.nix
|
||||
];
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
# Add your custom nixos modules to this folder, then import them here.
|
||||
{
|
||||
imports = [
|
||||
# ./example.nix
|
||||
];
|
||||
}
|
|
@ -3,5 +3,5 @@ final: prev: {
|
|||
# example = prev.example.overrideAttrs (oldAttrs: rec {
|
||||
# ...
|
||||
# });
|
||||
} // import ../pkgs { pkgs = final; }
|
||||
} // import ./pkgs { pkgs = final; }
|
||||
# This line adds your custom packages to the overlay.
|
Loading…
Reference in a new issue