Updated inputs, merged changes from pull requests:
- https://github.com/snowfallorg/lib/pull/148 - https://github.com/snowfallorg/lib/pull/147 - https://github.com/snowfallorg/lib/pull/144
This commit is contained in:
parent
02d941739f
commit
9a06683ed6
5 changed files with 59 additions and 21 deletions
21
flake.lock
generated
21
flake.lock
generated
|
|
@ -3,11 +3,11 @@
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1650374568,
|
"lastModified": 1747046372,
|
||||||
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
|
||||||
"owner": "edolstra",
|
"owner": "edolstra",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -39,32 +39,31 @@
|
||||||
"flake-utils": "flake-utils"
|
"flake-utils": "flake-utils"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715533576,
|
"lastModified": 1738591040,
|
||||||
"narHash": "sha256-fT4ppWeCJ0uR300EH3i7kmgRZnAVxrH+XtK09jQWihk=",
|
"narHash": "sha256-4WNeriUToshQ/L5J+dTSWC5OJIwT39SEP7V7oylndi8=",
|
||||||
"owner": "gytis-ivaskevicius",
|
"owner": "gytis-ivaskevicius",
|
||||||
"repo": "flake-utils-plus",
|
"repo": "flake-utils-plus",
|
||||||
"rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f",
|
"rev": "afcb15b845e74ac5e998358709b2b5fe42a948d1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "gytis-ivaskevicius",
|
"owner": "gytis-ivaskevicius",
|
||||||
"repo": "flake-utils-plus",
|
"repo": "flake-utils-plus",
|
||||||
"rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1716181197,
|
"lastModified": 1754767907,
|
||||||
"narHash": "sha256-IXOUlMlt0f5n9BoJ56+CseCLV9aaBDoEygIWV/hnUso=",
|
"narHash": "sha256-8OnUzRQZkqtUol9vuUuQC30hzpMreKptNyET2T9lB6g=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "461aad7a53142b9f9e2a666c810e86b20f5da76b",
|
"rev": "c5f08b62ed75415439d48152c2a784e36909b1bc",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "release-23.11",
|
"ref": "release-25.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
description = "Snowfall Lib";
|
description = "Snowfall Lib";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/release-23.11";
|
nixpkgs.url = "github:nixos/nixpkgs/release-25.05";
|
||||||
# NOTE: `nix flake lock --update-input flake-utils-plus` is currently NOT
|
# NOTE: `nix flake lock --update-input flake-utils-plus` is currently NOT
|
||||||
# giving us the appropriate revision. We need a fix from a recent PR in
|
# giving us the appropriate revision. We need a fix from a recent PR in
|
||||||
# FUP, so this revision is being hard coded here for now.
|
# FUP, so this revision is being hard coded here for now.
|
||||||
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus?rev=3542fe9126dc492e53ddd252bb0260fe035f2c0f";
|
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";
|
||||||
|
|
||||||
flake-compat = {
|
flake-compat = {
|
||||||
url = "github:edolstra/flake-compat";
|
url = "github:edolstra/flake-compat";
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
snowfall-lib,
|
snowfall-lib,
|
||||||
snowfall-config,
|
snowfall-config,
|
||||||
}: let
|
}: let
|
||||||
inherit (core-inputs.nixpkgs.lib) assertMsg foldl filterAttrs const;
|
inherit (core-inputs.nixpkgs.lib) assertMsg foldl filterAttrs const mapAttrs mapAttrs' hasSuffix removeSuffix nameValuePair;
|
||||||
in rec {
|
in rec {
|
||||||
flake = rec {
|
flake = rec {
|
||||||
## Remove the `self` attribute from an attribute set.
|
## Remove the `self` attribute from an attribute set.
|
||||||
|
|
@ -197,5 +197,31 @@ in rec {
|
||||||
inherit overlays;
|
inherit overlays;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
flake-outputs;
|
flake-outputs
|
||||||
|
// {
|
||||||
|
packages =
|
||||||
|
flake-outputs.packages
|
||||||
|
// (builtins.listToAttrs (
|
||||||
|
builtins.map (system: {
|
||||||
|
name = system;
|
||||||
|
value =
|
||||||
|
flake-outputs.packages.${system}
|
||||||
|
// {
|
||||||
|
homeConfigurations = let
|
||||||
|
homeNames = filterAttrs (_: home: home.system == system) homes;
|
||||||
|
homeConfigurations = mapAttrs (home-name: _: flake-outputs.homeConfigurations.${home-name}) homeNames;
|
||||||
|
renamedHomeConfigurations =
|
||||||
|
mapAttrs' (
|
||||||
|
name: value:
|
||||||
|
if hasSuffix "@${system}" name
|
||||||
|
then nameValuePair (removeSuffix "@${system}" name) value
|
||||||
|
else nameValuePair name value
|
||||||
|
)
|
||||||
|
homeConfigurations;
|
||||||
|
in
|
||||||
|
renamedHomeConfigurations;
|
||||||
|
};
|
||||||
|
}) (builtins.attrNames flake-outputs.pkgs)
|
||||||
|
));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,10 @@ in {
|
||||||
system ? "x86_64-linux",
|
system ? "x86_64-linux",
|
||||||
}: let
|
}: let
|
||||||
user-metadata = split-user-and-host name;
|
user-metadata = split-user-and-host name;
|
||||||
|
unique-name =
|
||||||
|
if user-metadata.host == ""
|
||||||
|
then "${user-metadata.user}@${system}"
|
||||||
|
else name;
|
||||||
|
|
||||||
# NOTE: home-manager has trouble with `pkgs` recursion if it isn't passed in here.
|
# NOTE: home-manager has trouble with `pkgs` recursion if it isn't passed in here.
|
||||||
pkgs = user-inputs.self.pkgs.${system}.${channelName} // {lib = home-lib;};
|
pkgs = user-inputs.self.pkgs.${system}.${channelName} // {lib = home-lib;};
|
||||||
|
|
@ -110,7 +114,8 @@ in {
|
||||||
++ modules;
|
++ modules;
|
||||||
|
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit name system;
|
inherit system;
|
||||||
|
name = unique-name;
|
||||||
inherit (user-metadata) user host;
|
inherit (user-metadata) user host;
|
||||||
|
|
||||||
format = "home";
|
format = "home";
|
||||||
|
|
@ -161,16 +166,22 @@ in {
|
||||||
get-target-homes-metadata = target: let
|
get-target-homes-metadata = target: let
|
||||||
homes = snowfall-lib.fs.get-directories target;
|
homes = snowfall-lib.fs.get-directories target;
|
||||||
existing-homes = builtins.filter (home: builtins.pathExists "${home}/default.nix") homes;
|
existing-homes = builtins.filter (home: builtins.pathExists "${home}/default.nix") homes;
|
||||||
create-home-metadata = path: {
|
create-home-metadata = path: let
|
||||||
path = "${path}/default.nix";
|
|
||||||
# We are building flake outputs based on file contents. Nix doesn't like this
|
# We are building flake outputs based on file contents. Nix doesn't like this
|
||||||
# so we have to explicitly discard the string's path context to allow us to
|
# so we have to explicitly discard the string's path context to allow us to
|
||||||
# use the name as a variable.
|
# use the name as a variable.
|
||||||
name = builtins.unsafeDiscardStringContext (builtins.baseNameOf path);
|
basename = builtins.unsafeDiscardStringContext (builtins.baseNameOf path);
|
||||||
# We are building flake outputs based on file contents. Nix doesn't like this
|
# We are building flake outputs based on file contents. Nix doesn't like this
|
||||||
# so we have to explicitly discard the string's path context to allow us to
|
# so we have to explicitly discard the string's path context to allow us to
|
||||||
# use the name as a variable.
|
# use the name as a variable.
|
||||||
system = builtins.unsafeDiscardStringContext (builtins.baseNameOf target);
|
system = builtins.unsafeDiscardStringContext (builtins.baseNameOf target);
|
||||||
|
name =
|
||||||
|
if !(hasInfix "@" basename)
|
||||||
|
then "${basename}@${system}"
|
||||||
|
else basename;
|
||||||
|
in {
|
||||||
|
path = "${path}/default.nix";
|
||||||
|
inherit name system;
|
||||||
};
|
};
|
||||||
home-configurations = builtins.map create-home-metadata existing-homes;
|
home-configurations = builtins.map create-home-metadata existing-homes;
|
||||||
in
|
in
|
||||||
|
|
@ -275,6 +286,7 @@ in {
|
||||||
config = {
|
config = {
|
||||||
home-manager.extraSpecialArgs = {
|
home-manager.extraSpecialArgs = {
|
||||||
inherit system target format virtual systems host;
|
inherit system target format virtual systems host;
|
||||||
|
inherit (snowfall-config) namespace;
|
||||||
|
|
||||||
lib = home-lib;
|
lib = home-lib;
|
||||||
|
|
||||||
|
|
@ -301,8 +313,8 @@ in {
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
host-matches =
|
host-matches =
|
||||||
(created-user.specialArgs.host == host)
|
(name == "${user-name}@${host}")
|
||||||
|| (created-user.specialArgs.host == "" && created-user.specialArgs.system == system);
|
|| (name == "${user-name}@${system}");
|
||||||
|
|
||||||
# NOTE: To conform to the config structure of home-manager, we have to
|
# NOTE: To conform to the config structure of home-manager, we have to
|
||||||
# remap the options coming from `snowfallorg.user.<name>.home.config` since `mkAliasDefinitions`
|
# remap the options coming from `snowfallorg.user.<name>.home.config` since `mkAliasDefinitions`
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ in {
|
||||||
user-inputs
|
user-inputs
|
||||||
// {
|
// {
|
||||||
inherit channels;
|
inherit channels;
|
||||||
|
inherit (snowfall-config) namespace;
|
||||||
inputs = user-inputs;
|
inputs = user-inputs;
|
||||||
lib = snowfall-lib.internal.system-lib;
|
lib = snowfall-lib.internal.system-lib;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue