massive refactor
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
./system-modules/kodi.nix
|
./system-modules/kodi.nix
|
||||||
./system-modules/networking.nix
|
./system-modules/networking.nix
|
||||||
./system-modules/nixd.nix
|
./system-modules/nixd.nix
|
||||||
|
./system-modules/nix.nix
|
||||||
./system-modules/nvidia.nix
|
./system-modules/nvidia.nix
|
||||||
./system-modules/obs.nix
|
./system-modules/obs.nix
|
||||||
./system-modules/ollama.nix
|
./system-modules/ollama.nix
|
||||||
@@ -57,12 +58,11 @@
|
|||||||
./system-modules/calendar/lec.nix
|
./system-modules/calendar/lec.nix
|
||||||
./system-modules/calendar/lr.nix
|
./system-modules/calendar/lr.nix
|
||||||
./system-modules/calendar/dicos.nix
|
./system-modules/calendar/dicos.nix
|
||||||
] else [
|
] else [ ]);
|
||||||
]);
|
|
||||||
environment.systemPackages = import ./system-modules/base-packages.nix pkgs;
|
environment.systemPackages = import ./system-modules/base-packages.nix pkgs;
|
||||||
|
|
||||||
system.stateVersion = hyper.pkgs-version;
|
system.stateVersion = hyper.main-pkgs-version;
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
||||||
programs.bash.shellInit = ''
|
programs.bash.shellInit = ''
|
||||||
if [[ "$USER" == "${hyper.user}" ]]; then
|
if [[ "$USER" == "${hyper.user}" ]]; then
|
||||||
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
|
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||||
|
|||||||
@@ -1,43 +1,31 @@
|
|||||||
{
|
pkgs: rec {
|
||||||
unfree = [
|
predicate = pkg: (
|
||||||
"antigravity"
|
builtins.elem (pkgs.lib.getName pkg) unfree.packages || builtins.all (
|
||||||
"cursor"
|
license: license.free || builtins.elem license.shortName unfree.licenses
|
||||||
"discord"
|
) (if builtins.isList pkg.meta.license then pkg.meta.license else [ pkg.meta.license ])
|
||||||
"spotify"
|
);
|
||||||
"obsidian"
|
unfree = {
|
||||||
"steam"
|
packages = [
|
||||||
"steam-unwrapped"
|
"antigravity"
|
||||||
"zoom-us"
|
"cursor"
|
||||||
"zoom"
|
"discord"
|
||||||
|
"obsidian"
|
||||||
|
"spotify"
|
||||||
|
"steam"
|
||||||
|
"steam-unwrapped"
|
||||||
|
"vscode-extension-mhutchie-git-graph"
|
||||||
|
"zoom"
|
||||||
|
"zoom-us"
|
||||||
|
|
||||||
"nvidia-x11"
|
"nvidia-x11"
|
||||||
"nvidia-settings"
|
"nvidia-settings"
|
||||||
"nvidia-persistenced"
|
];
|
||||||
"cudatoolkit"
|
licenses = [
|
||||||
"cuda-merged"
|
"CUDA EULA"
|
||||||
"cuda_cuobjdump"
|
"cuDNN EULA"
|
||||||
"cuda_gdb"
|
"cuTENSOR EULA"
|
||||||
"cuda_nvcc"
|
"NVidia OptiX EULA"
|
||||||
"cuda_nvdisasm"
|
];
|
||||||
"cuda_nvprune"
|
};
|
||||||
"cuda_cccl"
|
# insecure = [ ];
|
||||||
"cuda_cudart"
|
|
||||||
"cuda_cupti"
|
|
||||||
"cuda_cuxxfilt"
|
|
||||||
"cuda_nvml_dev"
|
|
||||||
"cuda_nvrtc"
|
|
||||||
"cuda_nvtx"
|
|
||||||
"cuda_profiler_api"
|
|
||||||
"cuda_sanitizer_api"
|
|
||||||
"libcublas"
|
|
||||||
"libcufft"
|
|
||||||
"libcurand"
|
|
||||||
"libcusolver"
|
|
||||||
"libnvjitlink"
|
|
||||||
"libcusparse"
|
|
||||||
"libnpp"
|
|
||||||
|
|
||||||
"vscode-extension-mhutchie-git-graph"
|
|
||||||
];
|
|
||||||
insecure = [ ];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
{
|
{
|
||||||
"base": {
|
"NxXPS": {
|
||||||
"foreground": "#eedce1",
|
"base": {
|
||||||
"background": "#11080a"
|
"foreground": "#fecccc",
|
||||||
},
|
"background": "#190000"
|
||||||
"to_alter": {
|
},
|
||||||
"accent": "#bb768a",
|
"to_alter": {
|
||||||
"secondary": "#b5ff32",
|
"accent": "#ff3232",
|
||||||
"tertiary": "#918ea3",
|
"secondary": "#ff3232",
|
||||||
"special": "#76bba7",
|
"tertiary": "#ff3232",
|
||||||
"weird": "#b7bb76"
|
"special": "#31feff",
|
||||||
|
"weird": "#baff31"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
35
flake-modules/hyper.nix
Normal file
35
flake-modules/hyper.nix
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
let hyper-base = rec {
|
||||||
|
host = "BaseHost";
|
||||||
|
system = "x86_64-linux";
|
||||||
|
user = "nx2";
|
||||||
|
domain = "nx2.site";
|
||||||
|
home = "/home/${user}";
|
||||||
|
webroot = if isServer then "/var/lib/hugo/nx2site/public" else assert false "No webroot on non-servers"; "";
|
||||||
|
main-pkgs-version = "25.11";
|
||||||
|
isServer = false;
|
||||||
|
isMobile = false;
|
||||||
|
isNOD = false;
|
||||||
|
nvidia = {
|
||||||
|
enable = false;
|
||||||
|
prime = false;
|
||||||
|
};
|
||||||
|
}; in host: if host == "NxNORTH" then hyper-base // { inherit host;
|
||||||
|
nvidia.enable = true;
|
||||||
|
} else if host == "NxXPS" then hyper-base // { inherit host;
|
||||||
|
nvidia = {
|
||||||
|
enable = true;
|
||||||
|
prime = true;
|
||||||
|
};
|
||||||
|
isMobile = true;
|
||||||
|
} else if host == "NxACE" then hyper-base // { inherit host;
|
||||||
|
isServer = true;
|
||||||
|
} else if host == "NxDCS" then hyper-base // { inherit host;
|
||||||
|
isMobile = true;
|
||||||
|
} else if host == "NxS23U" then hyper-base // { inherit host;
|
||||||
|
isMobile = true;
|
||||||
|
isNOD = true;
|
||||||
|
main-pkgs-version = "24.05";
|
||||||
|
system = "aarch64-linux";
|
||||||
|
user = "nix-on-droid";
|
||||||
|
home = "/data/data/com.termux.nix/files/home";
|
||||||
|
} else assert false "unkown host"; {}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
enable = false;
|
|
||||||
prime = false;
|
|
||||||
}
|
|
||||||
43
flake-modules/nxlib/ricelib.nix
Normal file
43
flake-modules/nxlib/ricelib.nix
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
lib: let
|
||||||
|
# takes in "ff0044" (no hash!) and returns { r = "ff", g = "00", b = "44" }
|
||||||
|
slice-hex = hex: with builtins; { r = substring 0 2 hex; g = substring 2 2 hex; b = substring 4 2 hex; };
|
||||||
|
|
||||||
|
# takes in "44" and returns 64
|
||||||
|
drune-to-255 = drune: with builtins; (rune-to-num (substring 0 1 drune)) * 16 + (rune-to-num (substring 1 1 drune));
|
||||||
|
num-to-drune = num: "${num-to-rune (num / 16)}${num-to-rune (num - ((num / 16) * 16))}";
|
||||||
|
|
||||||
|
# takes in "D" and returns 13
|
||||||
|
# inspiration from https://github.com/bertof/nix-rice
|
||||||
|
rune-to-num = rune: let
|
||||||
|
dict = { "0" = 0; "1" = 1; "2" = 2; "3" = 3; "4" = 4; "5" = 5; "6" = 6; "7" = 7; "8" = 8; "9" = 9; "A" = 10; "B" = 11; "C" = 12; "D" = 13; "E" = 14; "F" = 15; };
|
||||||
|
in assert(builtins.hasAttr (lib.strings.toUpper rune) dict); builtins.getAttr (lib.strings.toUpper rune) dict;
|
||||||
|
|
||||||
|
# takes in 15 and returns "F"
|
||||||
|
num-to-rune = num: let
|
||||||
|
num-string = builtins.toString num;
|
||||||
|
dict = { "0" = "0"; "1" = "1"; "2" = "2"; "3" = "3"; "4" = "4"; "5" = "5"; "6" = "6"; "7" = "7"; "8" = "8"; "9" = "9"; "10" = "A"; "11" = "B"; "12" = "C"; "13" = "D"; "14" = "E"; "15" = "F"; };
|
||||||
|
in assert(builtins.hasAttr num-string dict); builtins.getAttr num-string dict;
|
||||||
|
|
||||||
|
# Keeps num between 0 and 255
|
||||||
|
# Make sure to pass in an int not a float
|
||||||
|
cap-255 = num: (if (num>255) then 255 else if (num<0) then 0 else num);
|
||||||
|
nohash = hex: with builtins; assert((stringLength hex) == 7); substring 1 6 hex;
|
||||||
|
in {
|
||||||
|
## USEFUL FUNCTIONS
|
||||||
|
# takes in a string like "#ff0044" and returns "ff0044" symbol
|
||||||
|
inherit nohash;
|
||||||
|
|
||||||
|
# This takes in something like "#ff0044" and returns "255,0,64"
|
||||||
|
hex-to-rgb-comma-string = hex: with (slice-hex (nohash hex)); with builtins; assert(isString hex); "${toString (drune-to-255 r)},${toString (drune-to-255 g)},${toString (drune-to-255 b)}";
|
||||||
|
|
||||||
|
# This is useful if you have a float (like a transparency value) and want a drune representation of it
|
||||||
|
# So 0.0 -> "00" and 1.0 -> "FF"
|
||||||
|
float-to-drune = f: with builtins; assert(isFloat f); "${num-to-rune (floor((255*f) / 16))}${num-to-rune (floor(255*f) - (floor((255*f) / 16) * 16))}";
|
||||||
|
|
||||||
|
# Takes in hex and a float. 0.5 is +50% brightness and (-0.5) is -50% brightness.
|
||||||
|
# So "#ff0044": 0.3 -> "#ff0055"
|
||||||
|
alter-luminace-hex = hex: amount: let
|
||||||
|
color-num = with (slice-hex (nohash hex)); { r = drune-to-255 r; g = drune-to-255 g; b = drune-to-255 b; };
|
||||||
|
alter = num: (num-to-drune (cap-255 (builtins.floor ((125 * amount) + (num * (1+amount))) )));
|
||||||
|
in with color-num; "#${alter r}${alter g}${alter b}";
|
||||||
|
}
|
||||||
29
flake-modules/pkgs.nix
Normal file
29
flake-modules/pkgs.nix
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
inputs: simple-pkgs: hyper: let
|
||||||
|
args = {
|
||||||
|
system = hyper.system;
|
||||||
|
config = {
|
||||||
|
allowUnfreePredicate = (import ./allowed.nix simple-pkgs).predicate;
|
||||||
|
cudaSupport = hyper.nvidia.enable;
|
||||||
|
cudaForwardCompat = hyper.nvidia.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
overlays = [(final: prev: {
|
||||||
|
unstable = import inputs.nixpkgs-unstable args;
|
||||||
|
latest = import inputs.nixpkgs-latest args;
|
||||||
|
pkgs-version = hyper.main-pkgs-version;
|
||||||
|
})] ++ (if hyper.isServer then [
|
||||||
|
inputs.copyparty.overlays.default
|
||||||
|
] else []);
|
||||||
|
in if !hyper.isNOD then
|
||||||
|
(import inputs.nixpkgs (args // { inherit overlays; }))
|
||||||
|
else (
|
||||||
|
(import inputs.nixpkgs (args // { inherit overlays; })) // # normal as base
|
||||||
|
(import inputs.nixpkgs24 (args // { # overwrite with old versions
|
||||||
|
overlays = [(final: prev: {
|
||||||
|
pkgs-version = "24.05";
|
||||||
|
})];
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
pkgs: rec {
|
pkgs: hyper: rec {
|
||||||
|
|
||||||
lib = import ../nxlib/ricelib.nix pkgs.lib;
|
lib = import ./nxlib/ricelib.nix pkgs.lib;
|
||||||
|
|
||||||
transparency = 0.8;
|
transparency = 0.8;
|
||||||
rounding = 3;
|
rounding = 3;
|
||||||
@@ -36,17 +36,12 @@ pkgs: rec {
|
|||||||
red = "#dd4444"; # "#dd1111" "#00aa00";
|
red = "#dd4444"; # "#dd1111" "#00aa00";
|
||||||
yellow = "#dddd44"; # "#dddd11" "#ffff00";
|
yellow = "#dddd44"; # "#dddd11" "#ffff00";
|
||||||
};
|
};
|
||||||
facolor = builtins.mapAttrs alter-set (builtins.fromJSON (builtins.readFile ./colors.json)).to_alter;
|
facolor = builtins.mapAttrs alter-set (builtins.fromJSON (builtins.readFile ./colors.json))."${hyper.host}".to_alter;
|
||||||
fbcolor = (builtins.fromJSON (builtins.readFile ./colors.json)).base;
|
fbcolor = (builtins.fromJSON (builtins.readFile ./colors.json))."${hyper.host}".base;
|
||||||
fcolor = facolor // fbcolor;
|
fcolor = facolor // fbcolor;
|
||||||
xcolor = with ccolor; with fcolor; {
|
xcolor = with ccolor; with fcolor; {
|
||||||
# background = "#000000";
|
# background = "#000000";
|
||||||
# foreground = "#dddddd";
|
# foreground = "#dddddd";
|
||||||
# accent = blue;
|
|
||||||
# secondary = cyan;
|
|
||||||
# tertiary = magenta;
|
|
||||||
# special = yellow;
|
|
||||||
# weird = green;
|
|
||||||
subtle = { darker = "#111111"; dark = "#444444"; base = "#777777"; bright = "#999999"; brighter = "#cccccc"; };
|
subtle = { darker = "#111111"; dark = "#444444"; base = "#777777"; bright = "#999999"; brighter = "#cccccc"; };
|
||||||
positive = alter "#00dd00";
|
positive = alter "#00dd00";
|
||||||
negative = alter "#dd0000";
|
negative = alter "#dd0000";
|
||||||
@@ -61,8 +56,6 @@ pkgs: rec {
|
|||||||
regular-path = "${package}/share/fonts/truetype/NerdFonts/JetBrainsMonoNerdFont-Regular.ttf";
|
regular-path = "${package}/share/fonts/truetype/NerdFonts/JetBrainsMonoNerdFont-Regular.ttf";
|
||||||
};
|
};
|
||||||
base = {
|
base = {
|
||||||
# name = "NewComputerModern08";
|
|
||||||
# package = pkgs.newcomputermodern;
|
|
||||||
name = "Atkinson Hyperlegible";
|
name = "Atkinson Hyperlegible";
|
||||||
package = pkgs.atkinson-hyperlegible-next;
|
package = pkgs.atkinson-hyperlegible-next;
|
||||||
};
|
};
|
||||||
|
|||||||
123
flake.nix
123
flake.nix
@@ -7,28 +7,17 @@
|
|||||||
nixpkgs-latest.url = "github:nixos/nixpkgs?ref=master";
|
nixpkgs-latest.url = "github:nixos/nixpkgs?ref=master";
|
||||||
nixpkgs24.url = "github:NixOS/nixpkgs/nixos-24.05";
|
nixpkgs24.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||||
|
|
||||||
home-manager = {
|
home-manager = { url = "github:nix-community/home-manager/release-25.11"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||||
url = "github:nix-community/home-manager/release-25.11";
|
home-manager24 = { url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs24"; };
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
home-manager24 ={
|
|
||||||
url = "github:nix-community/home-manager/release-24.05";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs24";
|
|
||||||
};
|
|
||||||
|
|
||||||
nix-on-droid = {
|
nix-on-droid = {
|
||||||
url = "github:nix-community/nix-on-droid/release-24.05";
|
url = "github:nix-community/nix-on-droid/release-24.05";
|
||||||
inputs.nixpkgs.follows = "nixpkgs24";
|
inputs = { nixpkgs.follows = "nixpkgs24"; home-manager.follows = "home-manager24"; };
|
||||||
inputs.home-manager.follows = "home-manager24";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
|
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
|
||||||
|
|
||||||
sops-nix ={
|
sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||||
url = "github:Mic92/sops-nix";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
|
|
||||||
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.2";
|
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.2";
|
||||||
|
|
||||||
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
|
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
|
||||||
@@ -37,101 +26,63 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs = { ... }@inputs: with inputs; let
|
outputs = { ... }@inputs: with inputs; let
|
||||||
|
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
simple-pkgs = import nixpkgs { inherit system; };
|
simple-pkgs = import nixpkgs { inherit system; };
|
||||||
config = { allowUnfreePredicate = pkg: builtins.elem (simple-pkgs.lib.getName pkg) (import ./flake-modules/allowed.nix).unfree; };
|
get-pkgs = import ./flake-modules/pkgs.nix inputs simple-pkgs;
|
||||||
|
get-hyper = import ./flake-modules/hyper.nix;
|
||||||
hyper-base = rec {
|
secrets = import ./git-crypt/secrets.nix;
|
||||||
system = "x86_64-linux";
|
get-rice = import ./flake-modules/rice.nix simple-pkgs;
|
||||||
user = "nx2";
|
|
||||||
domain = "nx2.site";
|
|
||||||
home = "/home/${user}";
|
|
||||||
webroot = "/var/lib/hugo/nx2site/public";
|
|
||||||
pkgs-version = "25.11";
|
|
||||||
};
|
|
||||||
|
|
||||||
get-pkgs = let s = system; in { host, system?s, nixpkgs?inputs.nixpkgs, version?"25.11" }: import nixpkgs {
|
|
||||||
inherit system config;
|
|
||||||
overlays = [(final: prev: {
|
|
||||||
unstable = import nixpkgs-unstable { inherit system config; };
|
|
||||||
latest = import nixpkgs-latest { inherit system config; };
|
|
||||||
pkgs-version = version;
|
|
||||||
})] ++ (if host == "NxACE" then [
|
|
||||||
copyparty.overlays.default
|
|
||||||
] else []);
|
|
||||||
};
|
|
||||||
|
|
||||||
nvidia-base = import ./flake-modules/nvidia.nix;
|
|
||||||
secrets = import ./git-crypt/secrets.nix;
|
|
||||||
rice = import ./flake-modules/rice.nix simple-pkgs;
|
|
||||||
in {
|
in {
|
||||||
nixosConfigurations = let
|
nixosConfigurations = let
|
||||||
make-nixos-system = host: nvidia-settings: nixpkgs.lib.nixosSystem {
|
make-nixos-system = host: let
|
||||||
pkgs = get-pkgs { inherit host; };
|
hyper = get-hyper host;
|
||||||
|
rice = get-rice hyeper;
|
||||||
|
in nixpkgs.lib.nixosSystem {
|
||||||
|
pkgs = get-pkgs hyper;
|
||||||
modules = [ ./configuration.nix ];
|
modules = [ ./configuration.nix ];
|
||||||
specialArgs = let
|
specialArgs = { inherit inputs hyper rice secrets; };
|
||||||
hyper = hyper-base // { inherit host; nvidia = (nvidia-base // nvidia-settings); };
|
|
||||||
in { inherit inputs hyper rice secrets; };
|
|
||||||
};
|
};
|
||||||
make-nixos-wsl-system = host: nixpkgs.lib.nixosSystem {
|
make-nixos-wsl-system = host: let hyper = get-hyper host; in nixpkgs.lib.nixosSystem {
|
||||||
pkgs = get-pkgs { inherit host; };
|
pkgs = get-pkgs hyper;
|
||||||
modules = [ ./wsl.nix ];
|
modules = [ ./wsl.nix ];
|
||||||
specialArgs = let
|
specialArgs = { inherit inputs hyper rice; };
|
||||||
hyper = hyper-base // { inherit host; };
|
|
||||||
rice = import ./flake-modules/rice.nix pkgs;
|
|
||||||
in { inherit inputs hyper rice; };
|
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
NxXPS = make-nixos-system "NxXPS" { enable = true; prime = true; };
|
NxNORTH = make-nixos-system "NxNORTH";
|
||||||
NxNORTH = make-nixos-system "NxNORTH" { enable = true; prime = false; };
|
NxXPS = make-nixos-system "NxXPS";
|
||||||
NxACE = make-nixos-system "NxACE" { enable = false; };
|
NxACE = make-nixos-system "NxACE";
|
||||||
NxDCS = make-nixos-wsl-system "NxDCS";
|
NxDCS = make-nixos-wsl-system "NxDCS";
|
||||||
};
|
};
|
||||||
|
|
||||||
nixOnDroidConfigurations = let
|
nixOnDroidConfigurations = let
|
||||||
makeNODConfiguration = host: nix-on-droid.lib.nixOnDroidConfiguration rec {
|
makeNODConfiguration = host: nix-on-droid.lib.nixOnDroidConfiguration rec {
|
||||||
pkgs = let
|
hyper = get-hyper host;
|
||||||
options = { inherit host; system = "aarch64-linux"; };
|
pkgs = get-pkgs hyper;
|
||||||
in (get-pkgs options) //
|
|
||||||
(get-pkgs (options // { version = "24.05"; nixpkgs = nixpkgs24; } )
|
|
||||||
);
|
|
||||||
modules = [ ./nod.nix ];
|
modules = [ ./nod.nix ];
|
||||||
home-manager-path = home-manager24.outPath;
|
home-manager-path = home-manager24.outPath;
|
||||||
extraSpecialArgs = let
|
extraSpecialArgs = { inherit inputs hyper rice; };
|
||||||
hyper = hyper-base // {
|
|
||||||
inherit host;
|
|
||||||
system = "aarch64-linux";
|
|
||||||
user = "nix-on-droid";
|
|
||||||
home = "/data/data/com.termux.nix/files/home";
|
|
||||||
pkgs-version = "24.05";
|
|
||||||
};
|
|
||||||
rice = import ./flake-modules/rice.nix pkgs;
|
|
||||||
in { inherit inputs hyper rice; };
|
|
||||||
};
|
};
|
||||||
in { NxS23U = makeNODConfiguration "NxS23U"; };
|
in { NxS23U = makeNODConfiguration "NxS23U"; };
|
||||||
|
|
||||||
homeConfigurations = let
|
homeConfigurations = let
|
||||||
make-home-configuration = host: user: nvidia-settings: home-manager.lib.homeManagerConfiguration {
|
make-home-configuration = host: let
|
||||||
pkgs = get-pkgs { inherit host; };
|
hyper = get-hyper host;
|
||||||
|
rice = get-rice hyper;
|
||||||
|
in home-manager.lib.homeManagerConfiguration {
|
||||||
|
pkgs = get-pkgs hyper;
|
||||||
modules = [ ./home.nix ];
|
modules = [ ./home.nix ];
|
||||||
extraSpecialArgs = let
|
extraSpecialArgs = { inherit inputs hyper rice secrets; };
|
||||||
hyper = hyper-base // { inherit host; nvidia = nvidia-base // nvidia-settings; };
|
|
||||||
in { inherit inputs hyper rice secrets; };
|
|
||||||
};
|
};
|
||||||
make-shell-configuration = host: user: home-manager.lib.homeManagerConfiguration {
|
make-shell-configuration = host: let hyper = get-hyper host; in home-manager.lib.homeManagerConfiguration {
|
||||||
pkgs = get-pkgs { inherit host; };
|
pkgs = get-pkgs hyper;
|
||||||
modules = [ ./shell-only.nix ];
|
modules = [ ./shell-only.nix ];
|
||||||
extraSpecialArgs = let
|
extraSpecialArgs = { inherit inputs hyper rice secrets; };
|
||||||
hyper = hyper-base // { inherit host; };
|
|
||||||
in { inherit inputs hyper rice secrets; };
|
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
"${hyper-base.user}@NxXPS" = make-home-configuration "NxXPS" hyper-base.user { enable = true; prime = true; };
|
"nx2@NxXPS" = make-home-configuration "NxXPS";
|
||||||
"${hyper-base.user}@NxNORTH" = make-home-configuration "NxNORTH" hyper-base.user { enable = true; prime = false; };
|
"nx2@NxNORTH" = make-home-configuration "NxNORTH";
|
||||||
"${hyper-base.user}@NxACE" = make-home-configuration "NxACE" hyper-base.user { enable = false; };
|
"nx2@NxACE" = make-home-configuration "NxACE";
|
||||||
|
"nx2@NxDCS" = make-shell-configuration "NxDCS";
|
||||||
"${hyper-base.user}@NxDCS" = make-shell-configuration "NxDCS" hyper-base.user;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ def get_ongoing_or_next_event(url, username, password):
|
|||||||
|
|
||||||
for calendar in calendars:
|
for calendar in calendars:
|
||||||
for event in calendar.search(start=now):
|
for event in calendar.search(start=now):
|
||||||
|
if "VEVENT" not in event.data:
|
||||||
|
continue
|
||||||
calendar_parsed = Calendar(event.data)
|
calendar_parsed = Calendar(event.data)
|
||||||
for ics_event in calendar_parsed.events:
|
for ics_event in calendar_parsed.events:
|
||||||
event_dict = {}
|
event_dict = {}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
{ pkgs, ... }@all: with all;
|
{ pkgs, ... }@all: with all; {
|
||||||
{
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# (gimp-with-plugins.override {
|
gimp
|
||||||
# plugins = with gimpPlugins; [ bimp ];
|
|
||||||
# })
|
|
||||||
unstable.gimp
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
{ pkgs, ... }@all: with all;
|
{ pkgs, ... }@all: with all; {
|
||||||
{
|
|
||||||
home.packages = [
|
home.packages = [
|
||||||
(pkgs.writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "nx_backup";
|
name = "nx_backup";
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{ pkgs, ... }@all: with all;
|
{ pkgs, ... }@all: with all;
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [
|
home.packages = [
|
||||||
(writers.writePython3Bin "change_colors_json" {
|
(pkgs.writers.writePython3Bin "change_colors_json" {
|
||||||
libraries = with python3Packages; [ numpy pillow scikit-learn ];
|
libraries = with pkgs.python3Packages; [ numpy pillow scikit-learn ];
|
||||||
flakeIgnore = [ "E302" "E305" "E226" "E501" ];
|
flakeIgnore = [ "E302" "E305" "E226" "E501" ];
|
||||||
} /*python */ ''
|
} /*python */ ''
|
||||||
from colorsys import hls_to_rgb, rgb_to_hls
|
from colorsys import hls_to_rgb, rgb_to_hls
|
||||||
@@ -141,7 +141,10 @@
|
|||||||
foreground = alter_l(accent, 0.9)
|
foreground = alter_l(accent, 0.9)
|
||||||
background = alter_l(accent, 0.05)
|
background = alter_l(accent, 0.05)
|
||||||
|
|
||||||
d = {
|
with open("${hyper.home}/nix-dots/flake-modules/colors.json", "r") as f:
|
||||||
|
full_d = json.load(f)
|
||||||
|
|
||||||
|
full_d['${hyper.host}'] = {
|
||||||
"base": {
|
"base": {
|
||||||
"foreground": list_to_hex(foreground),
|
"foreground": list_to_hex(foreground),
|
||||||
"background": list_to_hex(background)
|
"background": list_to_hex(background)
|
||||||
@@ -155,8 +158,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with open("/home/nx2/nix-dots/flake-modules/colors.json", "w") as f:
|
with open("${hyper.home}/nix-dots/flake-modules/colors.json", "w") as f:
|
||||||
f.write(json.dumps(d, indent=4))
|
f.write(json.dumps(full_d, indent=4))
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
2
home.nix
2
home.nix
@@ -71,6 +71,6 @@
|
|||||||
home.username = hyper.user;
|
home.username = hyper.user;
|
||||||
home.homeDirectory = hyper.home;
|
home.homeDirectory = hyper.home;
|
||||||
# home.homeDirectory = "/home/${hyper.user}";
|
# home.homeDirectory = "/home/${hyper.user}";
|
||||||
home.stateVersion = hyper.pkgs-version;
|
home.stateVersion = hyper.main-pkgs-version;
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
lib:
|
|
||||||
let
|
|
||||||
# takes in "ff0044" (no hash!) and returns { r = "ff", g = "00", b = "44" }
|
|
||||||
slice-hex = hex: with builtins; { r = substring 0 2 hex; g = substring 2 2 hex; b = substring 4 2 hex; };
|
|
||||||
|
|
||||||
# takes in "44" and returns 64
|
|
||||||
drune-to-255 = drune: with builtins; (rune-to-num (substring 0 1 drune)) * 16 + (rune-to-num (substring 1 1 drune));
|
|
||||||
num-to-drune = num: "${num-to-rune (num / 16)}${num-to-rune (num - ((num / 16) * 16))}";
|
|
||||||
|
|
||||||
# takes in "D" and returns 13
|
|
||||||
rune-to-num = rune: # inspiration from https://github.com/bertof/nix-rice
|
|
||||||
let
|
|
||||||
dict = {
|
|
||||||
"0" = 0;
|
|
||||||
"1" = 1;
|
|
||||||
"2" = 2;
|
|
||||||
"3" = 3;
|
|
||||||
"4" = 4;
|
|
||||||
"5" = 5;
|
|
||||||
"6" = 6;
|
|
||||||
"7" = 7;
|
|
||||||
"8" = 8;
|
|
||||||
"9" = 9;
|
|
||||||
"A" = 10;
|
|
||||||
"B" = 11;
|
|
||||||
"C" = 12;
|
|
||||||
"D" = 13;
|
|
||||||
"E" = 14;
|
|
||||||
"F" = 15;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
assert(builtins.hasAttr (lib.strings.toUpper rune) dict);
|
|
||||||
builtins.getAttr (lib.strings.toUpper rune) dict;
|
|
||||||
|
|
||||||
# takes in 15 and returns "F"
|
|
||||||
num-to-rune = num:
|
|
||||||
let
|
|
||||||
num-string = builtins.toString num;
|
|
||||||
dict = {
|
|
||||||
"0" = "0";
|
|
||||||
"1" = "1";
|
|
||||||
"2" = "2";
|
|
||||||
"3" = "3";
|
|
||||||
"4" = "4";
|
|
||||||
"5" = "5";
|
|
||||||
"6" = "6";
|
|
||||||
"7" = "7";
|
|
||||||
"8" = "8";
|
|
||||||
"9" = "9";
|
|
||||||
"10" = "A";
|
|
||||||
"11" = "B";
|
|
||||||
"12" = "C";
|
|
||||||
"13" = "D";
|
|
||||||
"14" = "E";
|
|
||||||
"15" = "F";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
assert(builtins.hasAttr num-string dict);
|
|
||||||
builtins.getAttr num-string dict;
|
|
||||||
|
|
||||||
# Keeps num between 0 and 255
|
|
||||||
# Make sure to pass in an int not a float
|
|
||||||
cap-255 = num: (if (num>255) then 255 else if (num<0) then 0 else num);
|
|
||||||
|
|
||||||
nohash = hex: with builtins; assert((stringLength hex) == 7); substring 1 6 hex;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
|
|
||||||
## USEFUL FUNCTIONS
|
|
||||||
# --------------------------------------------------------------------------------
|
|
||||||
# takes in a string like "#ff0044" and returns "ff0044" symbol
|
|
||||||
inherit nohash;
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------
|
|
||||||
# This takes in something like "#ff0044" and returns "255,0,64"
|
|
||||||
hex-to-rgb-comma-string = hex:
|
|
||||||
with (slice-hex (nohash hex));
|
|
||||||
with builtins;
|
|
||||||
assert(isString hex);
|
|
||||||
"${toString (drune-to-255 r)},${toString (drune-to-255 g)},${toString (drune-to-255 b)}";
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------
|
|
||||||
# This is useful if you have a float (like a transparency value) and want a drune representation of it
|
|
||||||
# So 0.0 -> "00" and 1.0 -> "FF"
|
|
||||||
float-to-drune = f: with builtins; assert(isFloat f); "${num-to-rune (floor((255*f) / 16))}${num-to-rune (floor(255*f) - (floor((255*f) / 16) * 16))}";
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------
|
|
||||||
# Takes in hex and a float. 0.5 is +50% brightness and (-0.5) is -50% brightness.
|
|
||||||
# So "#ff0044": 0.3 -> "#ff0055"
|
|
||||||
alter-luminace-hex = hex: amount:
|
|
||||||
let
|
|
||||||
color-num = with (slice-hex (nohash hex)); { r = drune-to-255 r; g = drune-to-255 g; b = drune-to-255 b; };
|
|
||||||
alter = num: (num-to-drune (cap-255 (builtins.floor ((125 * amount) + (num * (1+amount))) )));
|
|
||||||
in
|
|
||||||
with color-num; "#${alter r}${alter g}${alter b}";
|
|
||||||
}
|
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
home = {
|
home = {
|
||||||
username = hyper.user;
|
username = hyper.user;
|
||||||
homeDirectory = hyper.home;
|
homeDirectory = hyper.home;
|
||||||
stateVersion = hyper.pkgs-version;
|
stateVersion = hyper.main-pkgs-version;
|
||||||
};
|
};
|
||||||
xdg = {
|
xdg = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
14
system-modules/nix.nix
Normal file
14
system-modules/nix.nix
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{ ... }: {
|
||||||
|
nix.settings = {
|
||||||
|
experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
substituters = [
|
||||||
|
"https://cache.nixos.org/"
|
||||||
|
"https://cache.nixos-cuda.org"
|
||||||
|
"https://nix-community.cachix.org"
|
||||||
|
];
|
||||||
|
trusted-public-keys = [
|
||||||
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
|
"cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user