1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-19 09:29:36 +01:00

Fix stateversions, update lib

This commit is contained in:
Stefan Ellmauthaler 2022-06-14 14:31:57 +02:00
parent d4a085bba6
commit 9554aee2b6
Failed to extract signature
5 changed files with 32 additions and 17 deletions

View File

@ -65,7 +65,7 @@
(final: prev: { (final: prev: {
elss = (import ./lib { lib = final; }) prev; elss = (import ./lib { lib = final; }) prev;
}); });
inherit (extended-lib.elss) discoverModules moduleNames; inherit (extended-lib.elss) discoverModules moduleNames discoverMachines withModules;
in in
flake-utils-plus.lib.mkFlake rec{ flake-utils-plus.lib.mkFlake rec{
inherit self inputs; inherit self inputs;
@ -107,19 +107,23 @@
inherit inputs; inherit inputs;
}; };
extraArgs = { extraArgs = {
homeConfigurations = discoverModules ./users homeConfigurations = withModules ./users
(name: (
import (./users + "/${name}") { name, path }:
#import (./users + "/${name}")
import path
); );
}; };
}; };
hosts = discoverModules ./machines (name: { hosts = discoverMachines ./machines
modules = [ (./machines + "/${name}") ]; {
specialArgs = { lib = extended-lib; }; specialArgs = { lib = extended-lib; };
}); };
homeConfigurations = discoverModules ./users nixosModules = discoverModules ./modules;
homeConfigurations = withModules ./users
(name: (name:
let let
username = extended-lib.removeSuffix ".nix" name; username = extended-lib.removeSuffix ".nix" name;
@ -131,9 +135,9 @@
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";
stateVersion = "21.05"; stateVersion = "21.05";
}); });
outputsBuilder = channels: { outputsBuilder = channels: {
devShell = import ./secrets/shell.nix { devShells.default = import ./secrets/shell.nix {
pkgs = channels.nixpkgs; pkgs = channels.nixpkgs;
sops-nix = inputs.sops-nix.packages."${channels.nixpkgs.system}"; sops-nix = inputs.sops-nix.packages."${channels.nixpkgs.system}";
}; };

View File

@ -3,12 +3,22 @@ final: prev:
with prev; rec { with prev; rec {
moduleNames = dir: pipe dir [ moduleNames = dir: pipe dir [
builtins.readDir builtins.readDir
(filterAttrs (name: type: !hasPrefix "." name && (hasSuffix ".nix" name || type == "directory"))) (filterAttrs
(name: type: (!hasPrefix "." name && !hasPrefix "_" name
&& (hasSuffix ".nix" name || type == "directory"))))
attrNames attrNames
]; ];
discoverModules = dir: f: withModules = dir: f:
listToAttrs (map listToAttrs (map
(filename: (filename:
nameValuePair (removeSuffix ".nix" filename) (f filename)) let
path = dir + "/${filename}";
name = removeSuffix ".nix" filename;
in
nameValuePair name (f { inherit path name; }))
(moduleNames dir)); (moduleNames dir));
discoverModules = dir: withModules dir ({ path, name }: import path);
discoverMachines = dir: args:
withModules dir ({ path, name }:
{ modules = [ path ]; } // args);
} }

View File

@ -52,4 +52,5 @@
}; };
}; };
}; };
system.stateVersion = "22.05";
} }

View File

@ -14,9 +14,9 @@ with lib;{
config = { config = {
dbtype = "mysql"; dbtype = "mysql";
dbuser = "cloudstore_user"; dbuser = "cloudstore_user";
dbpassFile = sops.secrets.cloudstore_user.path; dbpassFile = config.sops.secrets.cloudstore_user.path;
adminuser = "storemin"; adminuser = "storemin";
adminpassFile = sops.secrets.storemin.path; adminpassFile = config.sops.secrets.storemin.path;
}; };
}; };

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ...}: { config, lib, pkgs, ...}:
{ {
system.stateVersion = "21.05"; system.stateVersion = mkDefault "21.05";
} }