Migrate to flake
This commit is contained in:
parent
7e24481850
commit
6cdbba8c60
42 changed files with 842 additions and 770 deletions
58
flake.nix
Normal file
58
flake.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-21.11";
|
||||
home-manager.url = "github:nix-community/home-manager/release-21.11";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs-stable";
|
||||
#fabianhauser-etaxes.url = "github:fabianhauser/etaxes-sg-nix";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs-unstable, nixpkgs-stable, home-manager, ... }@inputs:
|
||||
let system = "x86_64-linux";
|
||||
pkgsUnstable = import nixpkgs-unstable {
|
||||
inherit system;
|
||||
config.allowUnfree = true; # For vscode
|
||||
};
|
||||
in {
|
||||
checks.${system}.formatCheck = let pkgs = pkgsUnstable; in pkgs.runCommand "nixfmt-check" { } ''
|
||||
set -euo pipefail
|
||||
cd ${self}
|
||||
${pkgs.findutils}/bin/find . -type f -name '*.nix' -exec ${pkgs.nixfmt}/bin/nixfmt --check {} +
|
||||
mkdir $out
|
||||
'';
|
||||
|
||||
# Build with `nixos-rebuild --flake .#<hostname>` or
|
||||
# `nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel
|
||||
nixosConfigurations = let
|
||||
hosts = [ "speer" "hummelberg" ];
|
||||
home-manager-modules = [ home-manager.nixosModules.home-manager {
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = { inherit pkgsUnstable; };
|
||||
users.fhauser = import ./home/fhauser/default.nix;
|
||||
};
|
||||
}];
|
||||
mapHostnameToAttr = host:
|
||||
nixpkgs-stable.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [ ./host/${host}/default.nix ] ++ home-manager-modules;
|
||||
};
|
||||
in pkgsUnstable.lib.genAttrs hosts mapHostnameToAttr;
|
||||
|
||||
|
||||
homeConfigurations = {
|
||||
fhauser = home-manager.lib.homeManagerConfiguration rec {
|
||||
inherit system;
|
||||
username = "fhauser";
|
||||
configuration = import ./home/${username}/default.nix;
|
||||
extraSpecialArgs = { inherit pkgsUnstable; };
|
||||
|
||||
# Update the state version as needed.
|
||||
# See the changelog here:
|
||||
# https://nix-community.github.io/home-manager/release-notes.html#sec-release-21.05
|
||||
stateVersion = "21.11";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue