Squash some bugs that kept nix from building
This commit is contained in:
parent
fed4c28152
commit
bc1cfdfeaf
@ -47,10 +47,13 @@ in
|
|||||||
stateVersion = "21.05";
|
stateVersion = "21.05";
|
||||||
username = "h7x4";
|
username = "h7x4";
|
||||||
homeDirectory = "/home/h7x4";
|
homeDirectory = "/home/h7x4";
|
||||||
|
# enableNixpkgsReleaseCheck = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
news.display = "silent";
|
news.display = "silent";
|
||||||
|
|
||||||
|
fonts.fontconfig.enable = true;
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
|
|
||||||
@ -58,37 +61,30 @@ in
|
|||||||
bottom.enable = true;
|
bottom.enable = true;
|
||||||
exa.enable = true;
|
exa.enable = true;
|
||||||
feh.enable = true;
|
feh.enable = true;
|
||||||
|
|
||||||
fzf = {
|
fzf = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultCommand = "fd --type f";
|
defaultCommand = "fd --type f";
|
||||||
};
|
};
|
||||||
|
|
||||||
gpg.enable = true;
|
gpg.enable = true;
|
||||||
irssi.enable = true;
|
irssi.enable = true;
|
||||||
|
kakoune.enable = true;
|
||||||
lazygit.enable = true;
|
lazygit.enable = true;
|
||||||
mpv.enable = true;
|
|
||||||
ssh.enable = true;
|
|
||||||
|
|
||||||
man = {
|
man = {
|
||||||
enable = true;
|
enable = true;
|
||||||
generateCaches = true;
|
generateCaches = true;
|
||||||
};
|
};
|
||||||
|
mpv.enable = true;
|
||||||
obs-studio.enable = true;
|
obs-studio.enable = true;
|
||||||
|
ssh.enable = true;
|
||||||
skim = {
|
skim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultCommand ="fd --type f";
|
defaultCommand ="fd --type f";
|
||||||
};
|
};
|
||||||
|
|
||||||
texlive = {
|
texlive = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# packageSet = pkgs.texlive.combined.scheme-medium;
|
# packageSet = pkgs.texlive.combined.scheme-medium;
|
||||||
};
|
};
|
||||||
|
|
||||||
# xmobar.enable = true;
|
# xmobar.enable = true;
|
||||||
|
|
||||||
zoxide.enable = true;
|
zoxide.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -129,6 +125,8 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xdg.enable = true;
|
||||||
|
|
||||||
xsession = {
|
xsession = {
|
||||||
pointerCursor = {
|
pointerCursor = {
|
||||||
package = pkgs.capitaine-cursors;
|
package = pkgs.capitaine-cursors;
|
||||||
|
@ -11,7 +11,7 @@ in super.lib.strings // rec {
|
|||||||
concatStringsSep splitter (map f (splitString splitter string));
|
concatStringsSep splitter (map f (splitString splitter string));
|
||||||
|
|
||||||
# (String -> String) -> String -> String
|
# (String -> String) -> String -> String
|
||||||
mapLines = splitMap "\n"
|
mapLines = splitMap "\n";
|
||||||
|
|
||||||
# String -> Int -> String
|
# String -> Int -> String
|
||||||
repeatString = string: times: concatStringsSep "" (repeat string times);
|
repeatString = string: times: concatStringsSep "" (repeat string times);
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
{ lib, ... }:
|
{ ... }:
|
||||||
let
|
let
|
||||||
|
|
||||||
|
# TODO: Fix overlay in home.nix
|
||||||
|
pkgs = import <nixos> { overlays = [(import ../../../overlays/lib)]; };
|
||||||
|
lib = pkgs.lib;
|
||||||
|
|
||||||
users = import ./users.nix;
|
users = import ./users.nix;
|
||||||
inherit (users.pvv) normalUser adminUser;
|
inherit (users.pvv) normalUser adminUser;
|
||||||
|
|
||||||
@ -33,68 +38,60 @@ let
|
|||||||
[ "innovation" "pvv-minecraft" ]
|
[ "innovation" "pvv-minecraft" ]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Either( String [String] AttrSet{String} ) -> AttrSet{String}
|
||||||
normalizeValueType = let
|
normalizeValueType = let
|
||||||
inherit (lib.strings) isString concatStringsSep;
|
inherit (lib.strings) isString;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.attrsets) filterAttrs;
|
inherit (lib.attrsets) filterAttrs;
|
||||||
in
|
in
|
||||||
machine:
|
machine:
|
||||||
if (isString machine) then (normalizeValueType [machine])
|
if (isString machine) then { names = [machine]; }
|
||||||
else if (isList machine) then (normalizeValueType { names = machine; })
|
else if (isList machine) then { names = machine; }
|
||||||
else ({ name = concatStringsSep " " machine.names; } // (removeAttrs machine ["names"]));
|
else machine;
|
||||||
|
|
||||||
# TODO: Merge the following two functions. They have too much code in common.
|
# [String] -> AttrSet
|
||||||
convertNormalMachines = let
|
machineWithNames = let
|
||||||
inherit (lib.trivial) pipe;
|
|
||||||
inherit (lib.attrsets) listToAttrs;
|
|
||||||
inherit (lib.lists) head;
|
inherit (lib.lists) head;
|
||||||
inherit (lib.strings) split;
|
inherit (lib.strings) split;
|
||||||
|
in
|
||||||
|
names: { hostname = "${head names}.pvv.org"; };
|
||||||
|
|
||||||
convertNormalMachine = normalizedMachine:
|
# AttrSet -> AttrSet -> AttrSet
|
||||||
rec {
|
convertMachineWithDefaults = defaults: normalizedMachine: let
|
||||||
inherit (normalizedMachine) name;
|
inherit (lib.attrsets) nameValuePair;
|
||||||
value = ({
|
inherit (lib.strings) concatStringsSep;
|
||||||
hostname = "${head (split " " name)}.pvv.org";
|
inherit (normalizedMachine) names;
|
||||||
user = normalUser;
|
|
||||||
} // removeAttrs normalizedMachine ["name"]);
|
|
||||||
};
|
|
||||||
|
|
||||||
pipeline = [
|
name = concatStringsSep " " names;
|
||||||
(ms: map normalizeValueType ms)
|
value =
|
||||||
(ms: map convertNormalMachine ms)
|
(machineWithNames names)
|
||||||
listToAttrs
|
// defaults
|
||||||
];
|
// removeAttrs normalizedMachine ["names"];
|
||||||
in machines: pipe machines pipeline;
|
in
|
||||||
|
nameValuePair name value;
|
||||||
|
|
||||||
convertAdminMachines = let
|
# AttrSet -> AttrSet
|
||||||
inherit (lib.trivial) pipe;
|
convertNormalMachine = convertMachineWithDefaults { user = normalUser; };
|
||||||
|
# AttrSet -> AttrSet
|
||||||
|
convertAdminMachine =
|
||||||
|
convertMachineWithDefaults { user = adminUser; proxyJump = "hildring"; };
|
||||||
|
|
||||||
|
# [ Either(String [String] AttrSet{String}) ] -> (AttrSet -> AttrSet) -> AttrSet
|
||||||
|
convertMachinesWith = convertMachineFunction: let
|
||||||
inherit (lib.attrsets) listToAttrs;
|
inherit (lib.attrsets) listToAttrs;
|
||||||
inherit (lib.lists) head;
|
inherit (lib.trivial) pipe;
|
||||||
inherit (lib.strings) split;
|
|
||||||
|
|
||||||
convertAdminMachine = normalizedMachine:
|
|
||||||
rec {
|
|
||||||
inherit (normalizedMachine) name;
|
|
||||||
value = ({
|
|
||||||
hostname = "${head (split " " name)}.pvv.org";
|
|
||||||
user = adminUser;
|
|
||||||
proxyJump = "hildring";
|
|
||||||
} // removeAttrs normalizedMachine ["name"]);
|
|
||||||
};
|
|
||||||
|
|
||||||
pipeline = [
|
pipeline = [
|
||||||
(ms: map normalizeValueType ms)
|
(map normalizeValueType)
|
||||||
(ms: map convertAdminMachine ms)
|
(map convertMachineFunction)
|
||||||
listToAttrs
|
listToAttrs
|
||||||
];
|
];
|
||||||
in machines: pipe machines pipeline;
|
in
|
||||||
|
machines: pipe machines pipeline;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
programs.ssh.matchBlocks = let
|
programs.ssh.matchBlocks = lib.attrsets.concatAttrs [
|
||||||
concatSets = lib.lists.foldl (s1: s2: s1 // s2) {};
|
(convertMachinesWith convertNormalMachine normalMachines)
|
||||||
in concatSets [
|
(convertMachinesWith convertAdminMachine rootMachines)
|
||||||
(convertNormalMachines normalMachines)
|
|
||||||
(convertAdminMachines rootMachines)
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -20,22 +20,17 @@ let
|
|||||||
functors = let
|
functors = let
|
||||||
inherit (lib.strings) concatStringsSep;
|
inherit (lib.strings) concatStringsSep;
|
||||||
inherit (lib.termColors.front) blue;
|
inherit (lib.termColors.front) blue;
|
||||||
|
genWrapper = type: value: { inherit type; inherit value; };
|
||||||
in {
|
in {
|
||||||
shellPipe = {
|
shellPipe = {
|
||||||
wrap = s: {
|
wrap = genWrapper "shellPipe";
|
||||||
type = "shellPipe";
|
|
||||||
value = s;
|
|
||||||
};
|
|
||||||
apply = f: concatStringsSep " | " f.value;
|
apply = f: concatStringsSep " | " f.value;
|
||||||
stringify = f: concatStringsSep (blue "\n| ") f.value;
|
stringify = f: concatStringsSep (blue "\n| ") f.value;
|
||||||
};
|
};
|
||||||
join = {
|
join = {
|
||||||
wrap = s: {
|
wrap = genWrapper "join";
|
||||||
type = "join";
|
|
||||||
value = s;
|
|
||||||
};
|
|
||||||
apply = f: concatStringsSep " " f.value;
|
apply = f: concatStringsSep " " f.value;
|
||||||
stringify = f: concatStringsSep " \\\n " f.value;
|
stringify = f: concatStringsSep " \\\n " f.value;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -104,7 +99,7 @@ in rec {
|
|||||||
|
|
||||||
"Reminders" = {
|
"Reminders" = {
|
||||||
regex-escapechars = "echo \"[\\^$.|?*+()\"";
|
regex-escapechars = "echo \"[\\^$.|?*+()\"";
|
||||||
aliases = "${coreutils}/bin/cat $HOME/${home.file.aliases.target}";
|
aliases = "${coreutils}/bin/cat $HOME/${config.xdg.dataFile.aliases.target}";
|
||||||
};
|
};
|
||||||
|
|
||||||
# ░█▀█░▀█▀░█░█
|
# ░█▀█░▀█▀░█░█
|
||||||
@ -257,27 +252,28 @@ in rec {
|
|||||||
allCdNameValuePairs = flatten (map nthCdsAsNameValuePairs (range 1 9));
|
allCdNameValuePairs = flatten (map nthCdsAsNameValuePairs (range 1 9));
|
||||||
in
|
in
|
||||||
listToAttrs allCdNameValuePairs;
|
listToAttrs allCdNameValuePairs;
|
||||||
|
|
||||||
|
"Package Managers" = let
|
||||||
|
inherit (lib.attrsets) nameValuePair listToAttrs;
|
||||||
|
|
||||||
|
packageManagers = [
|
||||||
|
"apt"
|
||||||
|
"dpkg"
|
||||||
|
"flatpak"
|
||||||
|
"pacman"
|
||||||
|
"pamac"
|
||||||
|
"paru"
|
||||||
|
"rpm"
|
||||||
|
"snap"
|
||||||
|
"xbps"
|
||||||
|
"yay"
|
||||||
|
"yum"
|
||||||
|
];
|
||||||
|
|
||||||
|
command = "${coreutils}/bin/cat $HOME/${config.xdg.dataFile.packageManagerLecture.target}";
|
||||||
|
nameValuePairs = map (pm: nameValuePair pm command) packageManagers;
|
||||||
|
in listToAttrs nameValuePairs;
|
||||||
};
|
};
|
||||||
"Package Managers" = let
|
|
||||||
inherit (lib.attrsets) nameValuePair listToAttrs;
|
|
||||||
|
|
||||||
packageManagers = [
|
|
||||||
"apt"
|
|
||||||
"dpkg"
|
|
||||||
"flatpak"
|
|
||||||
"pacman"
|
|
||||||
"pamac"
|
|
||||||
"paru"
|
|
||||||
"rpm"
|
|
||||||
"snap"
|
|
||||||
"xbps"
|
|
||||||
"yay"
|
|
||||||
"yum"
|
|
||||||
];
|
|
||||||
|
|
||||||
command = "${coreutils}/bin/cat $HOME/${config.home.file.packageManagerLecture.target}";
|
|
||||||
nameValuePairs = map (pm: nameValuePair pm command) packageManagers;
|
|
||||||
in listToAttrs nameValuePairs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: flatten functions
|
# TODO: flatten functions
|
||||||
@ -332,9 +328,8 @@ in rec {
|
|||||||
allAttrValuesAreStrings _module.args.shellOptions.aliases;
|
allAttrValuesAreStrings _module.args.shellOptions.aliases;
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file = {
|
xdg.dataFile = {
|
||||||
aliases = {
|
aliases = {
|
||||||
target = ".local/share/aliases";
|
|
||||||
text = let
|
text = let
|
||||||
inherit (lib.strings) unlines wrap' replaceStrings' stringLength repeatString;
|
inherit (lib.strings) unlines wrap' replaceStrings' stringLength repeatString;
|
||||||
inherit (lib.attrsets) attrValues mapAttrs isAttrs;
|
inherit (lib.attrsets) attrValues mapAttrs isAttrs;
|
||||||
@ -360,7 +355,7 @@ in rec {
|
|||||||
|
|
||||||
applyFunctor = attrset: let
|
applyFunctor = attrset: let
|
||||||
applied = functors.${attrset.type}.stringify attrset;
|
applied = functors.${attrset.type}.stringify attrset;
|
||||||
indent' = "${indent} ${repeatString " " (stringLength n)}";
|
indent' = indent + (repeatString " " ((stringLength " ->") + (stringLength n)));
|
||||||
in replaceStrings' ["\n"] ("\n" + indent') applied;
|
in replaceStrings' ["\n"] ("\n" + indent') applied;
|
||||||
|
|
||||||
recurse = stringifyCategory (level + 1) n v;
|
recurse = stringifyCategory (level + 1) n v;
|
||||||
@ -370,15 +365,15 @@ in rec {
|
|||||||
recurse) category)));
|
recurse) category)));
|
||||||
in
|
in
|
||||||
(stringifyCategory 0 "Aliases" _module.args.shellOptions.aliases) + "\n";
|
(stringifyCategory 0 "Aliases" _module.args.shellOptions.aliases) + "\n";
|
||||||
};
|
};
|
||||||
packageManagerLecture = {
|
packageManagerLecture = {
|
||||||
target = ".local/share/package-manager.lecture";
|
target = "package-manager.lecture";
|
||||||
text = let
|
text = let
|
||||||
inherit (lib.strings) unlines;
|
inherit (lib.strings) unlines;
|
||||||
inherit (lib.termColors.front) red blue;
|
inherit (lib.termColors.front) red blue;
|
||||||
in unlines [
|
in unlines [
|
||||||
((red "This package manager is not installed on ") + (blue "NixOS") + (red "."))
|
((red "This package manager is not installed on ") + (blue "NixOS") + (red "."))
|
||||||
((red "Either use ") + ("\"nix-env -i\"") + (red "or install it through a configuration file."))
|
((red "Either use ") + ("\"nix-env -i\"") + (red " or install it through a configuration file."))
|
||||||
""
|
""
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user