Compare commits
No commits in common. "3e37f1fbd4dc0672bb00a410b3db8ea8c3814e89" and "75f5d7ee9dd4b452f42bf248a52cde0e0f4b1364" have entirely different histories.
3e37f1fbd4
...
75f5d7ee9d
10 changed files with 47 additions and 53 deletions
18
default.nix
18
default.nix
|
@ -3,8 +3,16 @@
|
||||||
# if evaluating inside the store, import the outputs.nix file
|
# if evaluating inside the store, import the outputs.nix file
|
||||||
|
|
||||||
let
|
let
|
||||||
# Ideally this file should not depend on nixpkgs lib itself, but I like the utilities here
|
contains = str: substr: let
|
||||||
lib = (import "${(import ./inputs.nix {}).nixpkgs}/lib");
|
str_length = builtins.stringLength str;
|
||||||
|
substr_length = builtins.stringLength substr;
|
||||||
|
listOfPossibleSubstrings = builtins.genList (i: builtins.substring i substr_length str) (str_length - substr_length + 1);
|
||||||
|
in if substr_length > str_length then false else builtins.any (x: x == substr) listOfPossibleSubstrings;
|
||||||
|
|
||||||
|
endsWith = str: substr: let
|
||||||
|
str_length = builtins.stringLength str;
|
||||||
|
substr_length = builtins.stringLength substr;
|
||||||
|
in if substr_length > str_length then false else builtins.substring (str_length - substr_length) str_length str == substr;
|
||||||
|
|
||||||
gitignore = builtins.filter (v:
|
gitignore = builtins.filter (v:
|
||||||
# ignore comments and empty lines
|
# ignore comments and empty lines
|
||||||
|
@ -24,11 +32,11 @@ let
|
||||||
if pattern == "*" then true
|
if pattern == "*" then true
|
||||||
else if pattern == ".*" then true
|
else if pattern == ".*" then true
|
||||||
else if pattern == "*.*" then true
|
else if pattern == "*.*" then true
|
||||||
else if builtins.substring 0 2 pattern == "*." then lib.hasSuffix (builtins.substring 0 2 pattern) path
|
else if builtins.substring 0 2 pattern == "*." then endsWith path (builtins.substring 0 2 pattern)
|
||||||
else if lib.hasInfix "*" pattern then abort unsupportedPatternMessage
|
else if contains pattern "*" then abort unsupportedPatternMessage
|
||||||
else if patternLength > 2 && builtins.substring 0 2 pattern == "./" then abort unsupportedPatternMessage
|
else if patternLength > 2 && builtins.substring 0 2 pattern == "./" then abort unsupportedPatternMessage
|
||||||
else if patternLength > 1 && builtins.substring 0 1 pattern == "/" then abort unsupportedPatternMessage
|
else if patternLength > 1 && builtins.substring 0 1 pattern == "/" then abort unsupportedPatternMessage
|
||||||
else lib.hasInfix pattern path
|
else contains path pattern
|
||||||
) gitignore;
|
) gitignore;
|
||||||
|
|
||||||
currentFilePath = (builtins.unsafeGetAttrPos "any" { any = "any"; }).file;
|
currentFilePath = (builtins.unsafeGetAttrPos "any" { any = "any"; }).file;
|
||||||
|
|
|
@ -15,11 +15,6 @@ let self = {
|
||||||
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz";
|
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz";
|
||||||
sha256 = "${lock.nixpkgs.sha256}";
|
sha256 = "${lock.nixpkgs.sha256}";
|
||||||
};
|
};
|
||||||
nixpkgs-unstable = builtins.fetchTarball {
|
|
||||||
name = "nixpkgs-unstable";
|
|
||||||
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs-unstable.revision}.tar.gz";
|
|
||||||
sha256 = "${lock.nixpkgs-unstable.sha256}";
|
|
||||||
};
|
|
||||||
cosmic-modules = builtins.fetchTarball {
|
cosmic-modules = builtins.fetchTarball {
|
||||||
name = "cosmic-modules";
|
name = "cosmic-modules";
|
||||||
url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz";
|
url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz";
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{ revision }:
|
{ inputs ? import ../../inputs.nix {} }:
|
||||||
|
|
||||||
selfLib: superLib: {
|
selfLib: superLib: {
|
||||||
trivial = superLib.trivial // {
|
trivial = superLib.trivial // {
|
||||||
versionSuffix = ".git.${builtins.substring 0 12 revision}";
|
versionSuffix = ".git.${builtins.substring 0 12 inputs.lock.nixpkgs.revision}";
|
||||||
revisionWithDefault = default: revision;
|
revisionWithDefault = default: inputs.lock.nixpkgs.revision or default;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
4
lock.nix
4
lock.nix
|
@ -7,10 +7,6 @@
|
||||||
revision = "3f0a8ac25fb674611b98089ca3a5dd6480175751";
|
revision = "3f0a8ac25fb674611b98089ca3a5dd6480175751";
|
||||||
sha256 = "10i7fllqjzq171afzhdf2d9r1pk9irvmq5n55h92rc47vlaabvr4";
|
sha256 = "10i7fllqjzq171afzhdf2d9r1pk9irvmq5n55h92rc47vlaabvr4";
|
||||||
};
|
};
|
||||||
nixpkgs-unstable = {
|
|
||||||
revision = "130595eba61081acde9001f43de3248d8888ac4a";
|
|
||||||
sha256 = "0sw7zg4gal3wpz51ch1v36pdan9z73d4f3yrggh8h2clxs8jdgsx";
|
|
||||||
};
|
|
||||||
cosmic-modules = {
|
cosmic-modules = {
|
||||||
revision = "a934c861065b6b1aca9a859c45631336e0e8560c";
|
revision = "a934c861065b6b1aca9a859c45631336e0e8560c";
|
||||||
sha256 = "1p0hs2z1h9fl25qvrlprf63cj1v0m7hr2y051mykjvdxikvn5a47";
|
sha256 = "1p0hs2z1h9fl25qvrlprf63cj1v0m7hr2y051mykjvdxikvn5a47";
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
{
|
{config, pkgs, lib, ...}:
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
self,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.unstable;
|
cfg = config.unstable;
|
||||||
unstableOverlay = self.overlays.unstableWithMeta;
|
unstableOverlay = import ../pkgs/overlays/unstable.nix;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.unstable = {
|
options.unstable = {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-info-fixup.nix { revision = inputs.lock.nixpkgs.revision; });
|
lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-info-fixup.nix { inherit inputs; });
|
||||||
|
|
||||||
self = {
|
self = {
|
||||||
inherit inputs lib self;
|
inherit inputs lib self;
|
||||||
|
@ -15,7 +15,7 @@ self = {
|
||||||
overlays = {
|
overlays = {
|
||||||
cosmicPackages = import ./pkgs/overlays/cosmic-packages.nix { inherit inputs; };
|
cosmicPackages = import ./pkgs/overlays/cosmic-packages.nix { inherit inputs; };
|
||||||
selfExpr = import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = inputs.nixpkgs; };
|
selfExpr = import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = inputs.nixpkgs; };
|
||||||
unstableWithMeta = import ./pkgs/overlays/unstable-with-meta.nix { unstableSource = inputs.nixpkgs-unstable; revision = inputs.lock.nixpkgs-unstable.revision; };
|
unstable = import ./pkgs/overlays/unstable.nix;
|
||||||
versionInfoFixup = import ./pkgs/overlays/version-info-fixup.nix { inherit inputs; };
|
versionInfoFixup = import ./pkgs/overlays/version-info-fixup.nix { inherit inputs; };
|
||||||
};
|
};
|
||||||
nixosConfigurations = let
|
nixosConfigurations = let
|
||||||
|
@ -26,7 +26,7 @@ self = {
|
||||||
( # regular .nix files
|
( # regular .nix files
|
||||||
(type == "regular" && lib.hasSuffix ".nix" name)
|
(type == "regular" && lib.hasSuffix ".nix" name)
|
||||||
|| # directories that contain a default.nix file
|
|| # directories that contain a default.nix file
|
||||||
(type == "directory" && builtins.pathExists "${./.}/hosts/${name}/default.nix")
|
(type == "directory" && builtins.pathExists "${./hosts}/${name}/default.nix")
|
||||||
)
|
)
|
||||||
# filter out files that start with .
|
# filter out files that start with .
|
||||||
&& !lib.hasPrefix "." name
|
&& !lib.hasPrefix "." name
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
unstableSource,
|
|
||||||
revision,
|
|
||||||
}: self: super:
|
|
||||||
|
|
||||||
let
|
|
||||||
version = builtins.readFile "${unstableSource}/lib/.version" + ".git." + builtins.substring 0 12 revision;
|
|
||||||
useUnstable = self.config.useUnstable or true;
|
|
||||||
|
|
||||||
in
|
|
||||||
import ./unstable-from-source.nix {
|
|
||||||
inherit unstableSource;
|
|
||||||
} self super // {
|
|
||||||
unstableVersion = self.lib.optionalString useUnstable version;
|
|
||||||
unstableRevision = self.lib.optionalString useUnstable revision;
|
|
||||||
}
|
|
24
pkgs/overlays/unstable.nix
Normal file
24
pkgs/overlays/unstable.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
self: super:
|
||||||
|
|
||||||
|
let
|
||||||
|
nixos = self.config.nixos or true;
|
||||||
|
useUnstable = self.config.useUnstable or true;
|
||||||
|
|
||||||
|
unstablePkgsExprs = if nixos
|
||||||
|
then builtins.fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
|
||||||
|
else builtins.fetchTarball "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
|
||||||
|
|
||||||
|
# Compiled nixpkgs expression eg expressions from a nix channel
|
||||||
|
nixpkgsVersion = builtins.concatStringsSep "." [
|
||||||
|
(builtins.readFile "${unstablePkgsExprs}/.version")
|
||||||
|
(builtins.readFile "${unstablePkgsExprs}/.version-suffix")
|
||||||
|
];
|
||||||
|
|
||||||
|
nixpkgsRevision = (builtins.readFile "${unstablePkgsExprs}/.git-revision");
|
||||||
|
in
|
||||||
|
import ./unstable-from-source.nix {
|
||||||
|
unstableSource = unstablePkgsExprs;
|
||||||
|
} self super // {
|
||||||
|
unstableVersion = self.lib.optionalString useUnstable nixpkgsVersion;
|
||||||
|
unstableRevision = self.lib.optionalString useUnstable nixpkgsRevision;
|
||||||
|
}
|
|
@ -1,12 +1,5 @@
|
||||||
{ inputs ? import ../../inputs.nix {} }:
|
{ inputs ? import ../../inputs.nix {} }:
|
||||||
|
|
||||||
self: super: {
|
self: super: {
|
||||||
lib = super.lib.extend (import ../../lib/overlays/version-info-fixup.nix { revision = inputs.lock.nixpkgs.revision; });
|
lib = super.lib.extend (import ../../lib/overlays/version-info-fixup.nix { inherit inputs; });
|
||||||
} //
|
|
||||||
super.lib.optionalAttrs (super ? unstable && super ? unstableRevision) {
|
|
||||||
unstable = super.unstable // {
|
|
||||||
lib = super.unstable.lib.extend (import ../../lib/overlays/version-info-fixup.nix {
|
|
||||||
revision = super.unstableRevision;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ let
|
||||||
overlays = (args.overlays or []) ++ [
|
overlays = (args.overlays or []) ++ [
|
||||||
# ../.. should be nix store path that represents self in outputs.nix that is gc-rooted by this point
|
# ../.. should be nix store path that represents self in outputs.nix that is gc-rooted by this point
|
||||||
( import ../overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ../..}/pkgs/top-level/impure.nix"; } )
|
( import ../overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ../..}/pkgs/top-level/impure.nix"; } )
|
||||||
( import ../overlays/unstable-with-meta.nix { unstableSource = inputs.nixpkgs-unstable; revision = inputs.lock.nixpkgs-unstable.revision; } )
|
( import ../overlays/unstable.nix )
|
||||||
( import ../overlays/version-info-fixup.nix { inherit inputs; } )
|
( import ../overlays/version-info-fixup.nix { inherit inputs; } )
|
||||||
( import ./by-name-overlay.nix ../by-name )
|
( import ./by-name-overlay.nix ../by-name )
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue