mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-06-09 10:29:05 +02:00
More refactoring
This commit is contained in:
parent
18b7795c15
commit
91aea7e1e1
7 changed files with 117 additions and 218 deletions
86
flake.nix
86
flake.nix
|
@ -1,43 +1,63 @@
|
|||
{
|
||||
description = "A flake for my personnal configurations";
|
||||
inputs = {
|
||||
nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11;
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
description = "A flake for my personnal configurations";
|
||||
inputs = {
|
||||
nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11;
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
neovim-nightly-overlay = {
|
||||
url = "github:nix-community/neovim-nightly-overlay";
|
||||
};
|
||||
neovim-nightly-overlay = {
|
||||
url = "github:nix-community/neovim-nightly-overlay";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, home-manager, nixpkgs, neovim-nightly-overlay, nur, ... }@inputs :
|
||||
{
|
||||
nixosModules = builtins.listToAttrs (map (x: {
|
||||
name = x;
|
||||
value = import (./modules + "/${x}");
|
||||
}) (builtins.attrNames (builtins.readDir ./modules)));
|
||||
|
||||
nixosConfigurations = {
|
||||
lisa = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = builtins.attrValues self.nixosModules ++ [./configuration.nix ./config/hosts/lisa.nix
|
||||
home-manager.nixosModules.home-manager {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.julien = import ./config/home/home-lisa.nix;
|
||||
nixpkgs.overlays = [
|
||||
inputs.neovim-nightly-overlay.overlay
|
||||
outputs = { self, home-manager, nixpkgs, neovim-nightly-overlay, nur, ... }@inputs:
|
||||
let
|
||||
importDir = dir: pipe dir [
|
||||
builtins.readDir
|
||||
(mapAttrsToList (name: type:
|
||||
if type == "regular" && hasSuffix ".nix" name && name != "default.nix" then
|
||||
[{ name = removeSuffix ".nix" name; value = import (dir + "/${name}"); }]
|
||||
else if type == "directory" && pathExists (dir + "/${name}/default.nix") then
|
||||
[{ inherit name; value = import (dir + "/${name}"); }]
|
||||
else
|
||||
[ ]
|
||||
))
|
||||
concatLists
|
||||
listToAttrs
|
||||
];
|
||||
mkMachine = host: host-config: modules: {
|
||||
lisa = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = builtins.attrValues modules ++ [
|
||||
./configuration.nix
|
||||
host-config
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.julien = import ./config/home/home-lisa.nix;
|
||||
nixpkgs.overlays = [
|
||||
inputs.neovim-nightly-overlay.overlay
|
||||
];
|
||||
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosModules = builtins.listToAttrs (map
|
||||
(x: {
|
||||
name = x;
|
||||
value = import (./modules + "/${x}");
|
||||
})
|
||||
(builtins.attrNames (builtins.readDir ./modules)));
|
||||
|
||||
};
|
||||
nixosConfigurations = mapAttrs (name: value: (mkMachine name value nixosModules)) (importDir ./machines);
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue