aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hosts/mercury/config.nix9
-rw-r--r--modules/boot/options.nix4
-rw-r--r--modules/boot/system/default.nix3
-rw-r--r--modules/desktop/system/components/dunst.nix2
-rw-r--r--modules/desktop/system/programs/foot.nix8
-rw-r--r--modules/nix/system/default.nix7
-rw-r--r--modules/services/options.nix28
-rw-r--r--modules/services/system/bluetooth.nix5
-rw-r--r--modules/services/system/networking/default.nix3
-rw-r--r--modules/services/system/networking/iwd.nix2
-rw-r--r--modules/services/system/networking/networkmanager.nix (renamed from modules/services/system/networking/nm.nix)2
-rw-r--r--modules/terminal/system/default.nix1
-rw-r--r--modules/terminal/system/programs/broot.nix8
-rw-r--r--modules/terminal/system/programs/cmus.nix43
-rw-r--r--modules/terminal/system/programs/git.nix29
-rw-r--r--modules/terminal/system/programs/helix.nix149
-rw-r--r--modules/terminal/system/programs/lazygit.nix8
-rw-r--r--modules/terminal/system/programs/nh.nix14
-rw-r--r--modules/terminal/system/programs/starship.nix9
-rw-r--r--modules/terminal/system/programs/tmux.nix6
-rw-r--r--modules/user/system/default.nix15
21 files changed, 196 insertions, 159 deletions
diff --git a/hosts/mercury/config.nix b/hosts/mercury/config.nix
index f18c772..f39552d 100644
--- a/hosts/mercury/config.nix
+++ b/hosts/mercury/config.nix
@@ -34,9 +34,12 @@
audio.enable = true;
networking = {
enable = true;
- wifiDaemon = "iwd";
+ iwd.enable = true;
+ };
+ bluetooth = {
+ enable = true;
+ bluetuith.enable = true;
};
- bluetooth.enable = true;
};
terminal = {
@@ -68,7 +71,7 @@
};
boot = {
- bootloader = "systemd-boot";
+ systemd-boot.enable = true;
plymouth.enable = true;
secureBoot.enable = true;
};
diff --git a/modules/boot/options.nix b/modules/boot/options.nix
index c040032..dc6d3b3 100644
--- a/modules/boot/options.nix
+++ b/modules/boot/options.nix
@@ -7,9 +7,7 @@
in {
options = {
collinux.boot = {
- bootloader = mkOption {
- type = types.enum ["grub" "systemd-boot"];
- };
+ systemd-boot.enable = mkEnableOption "systemd-boot";
plymouth = {
enable = mkEnableOption "plymouth bootsplash";
theme = mkOption {
diff --git a/modules/boot/system/default.nix b/modules/boot/system/default.nix
index e32601c..53f18be 100644
--- a/modules/boot/system/default.nix
+++ b/modules/boot/system/default.nix
@@ -17,11 +17,10 @@ in {
systemd.enable = true;
};
loader = {
- systemd-boot = lib.optionalAttrs (cfg.bootloader == "systemd-boot" && !cfg.secureBoot.enable) {
+ systemd-boot = lib.optionalAttrs (cfg.systemd-boot.enable && !cfg.secureBoot.enable) {
enable = true;
configurationLimit = 3;
};
- grub = lib.optionalAttrs (cfg.bootloader == "grub") {enable = true;};
efi.canTouchEfiVariables = true;
timeout = 0;
};
diff --git a/modules/desktop/system/components/dunst.nix b/modules/desktop/system/components/dunst.nix
index 9dfaa80..1069087 100644
--- a/modules/desktop/system/components/dunst.nix
+++ b/modules/desktop/system/components/dunst.nix
@@ -11,7 +11,7 @@
frame_color = "#89b4fa"
separator_color = frame
highlight = "#89b4fa"
- offset = "8x30"
+ offset = "(8,8)"
origin = "top-right"
transparency = 10
font = "Iosevka Nerd Font"
diff --git a/modules/desktop/system/programs/foot.nix b/modules/desktop/system/programs/foot.nix
index 8c9edbe..a061561 100644
--- a/modules/desktop/system/programs/foot.nix
+++ b/modules/desktop/system/programs/foot.nix
@@ -5,9 +5,8 @@
...
}: let
cfg = config.collinux.desktop.programs.foot;
- ini' = pkgs.formats.ini {listsAsDuplicateKeys = true;};
- settings = ini'.generate "foot.ini" {
+ settings = {
main = {
font = "Iosevka Nerd Font:size=12";
shell = "${pkgs.fish}/bin/fish";
@@ -53,7 +52,10 @@ in
lib.mkIf cfg.enable {
hjem.users."${config.collinux.user.name}" = {
files = {
- ".config/foot/foot.ini".source = settings;
+ ".config/foot/foot.ini" = {
+ generator = lib.generators.toINI {};
+ value = settings;
+ };
};
packages = [pkgs.foot];
diff --git a/modules/nix/system/default.nix b/modules/nix/system/default.nix
index c35d3b3..990e562 100644
--- a/modules/nix/system/default.nix
+++ b/modules/nix/system/default.nix
@@ -15,9 +15,14 @@
# Disable channels
nix.channel.enable = false;
- programs.command-not-found.enable = false; # breaks unless you use channels
nixpkgs = {
config.allowUnfree = true;
};
+
+ programs.nh = {
+ enable = true;
+ flake = "/home/collin/nixos";
+ clean.enable = true;
+ };
}
diff --git a/modules/services/options.nix b/modules/services/options.nix
index 344d37d..cda9299 100644
--- a/modules/services/options.nix
+++ b/modules/services/options.nix
@@ -1,20 +1,36 @@
-{lib, ...}: let
- inherit (lib) mkEnableOption mkOption types;
+{
+ lib,
+ config,
+ ...
+}: let
+ inherit (lib) mkEnableOption;
in {
options = {
collinux.services = {
networking = {
enable = mkEnableOption "wifi";
- wifiDaemon = mkOption {
- type = types.enum ["networkmanager" "iwd"];
- };
+ iwd.enable = mkEnableOption "lightweight wifi daemon";
+ networkmanager.enable = mkEnableOption "heavier wifi daemon";
};
audio = {
enable = mkEnableOption "pipewire + wireplumber";
pulse.enable = mkEnableOption "pipewire-pulse";
# some config to make audio work with wine (TODO for jupiter)
};
- bluetooth.enable = mkEnableOption "bluetooth";
+ bluetooth = {
+ enable = mkEnableOption "bluetooth";
+ blueman.enable = mkEnableOption "graphical bluetooth manager";
+ bluetuith.enable = mkEnableOption "terminal bluetooth manager";
+ };
};
};
+
+ config = {
+ assertions = [
+ {
+ assertion = with config.collinux.services.networking; !(iwd.enable && networkmanager.enable);
+ message = "can not use iwd and networkmanager at the same time";
+ }
+ ];
+ };
}
diff --git a/modules/services/system/bluetooth.nix b/modules/services/system/bluetooth.nix
index a0c3f86..a86b5b3 100644
--- a/modules/services/system/bluetooth.nix
+++ b/modules/services/system/bluetooth.nix
@@ -12,5 +12,8 @@ in
powerOnBoot = true;
};
- environment.systemPackages = [pkgs.blueman];
+ environment.systemPackages = [
+ (lib.mkIf cfg.blueman.enable pkgs.blueman)
+ (lib.mkIf cfg.bluetuith.enable pkgs.bluetuith)
+ ];
}
diff --git a/modules/services/system/networking/default.nix b/modules/services/system/networking/default.nix
index 4908b6f..68c794c 100644
--- a/modules/services/system/networking/default.nix
+++ b/modules/services/system/networking/default.nix
@@ -1,7 +1,7 @@
{
imports = [
./iwd.nix
- ./nm.nix
+ ./networkmanager.nix
];
config = {
@@ -16,4 +16,3 @@
networking.resolvconf.enable = false;
};
}
-
diff --git a/modules/services/system/networking/iwd.nix b/modules/services/system/networking/iwd.nix
index 5306f29..d081792 100644
--- a/modules/services/system/networking/iwd.nix
+++ b/modules/services/system/networking/iwd.nix
@@ -5,7 +5,7 @@
}: let
cfg = config.collinux.services.networking;
in
- lib.mkIf (cfg.enable && cfg.wifiDaemon == "iwd") {
+ lib.mkIf (cfg.enable && cfg.iwd.enable) {
networking = {
wireless.iwd = {
enable = true;
diff --git a/modules/services/system/networking/nm.nix b/modules/services/system/networking/networkmanager.nix
index 674664e..f22f922 100644
--- a/modules/services/system/networking/nm.nix
+++ b/modules/services/system/networking/networkmanager.nix
@@ -5,7 +5,7 @@
}: let
cfg = config.collinux.services.networking;
in
- lib.mkIf (cfg.enable && cfg.wifiDaemon == "networkmanager") {
+ lib.mkIf (cfg.enable && cfg.networkmanager.enable) {
networking = {
nameservers = ["1.1.1.1" "1.0.0.1"];
enableIPv6 = false;
diff --git a/modules/terminal/system/default.nix b/modules/terminal/system/default.nix
index d113944..120e967 100644
--- a/modules/terminal/system/default.nix
+++ b/modules/terminal/system/default.nix
@@ -4,7 +4,6 @@ in {
imports = [
./programs/fzf.nix
./programs/bat.nix
- ./programs/nh.nix
./programs/lazygit.nix
./programs/eza.nix
./programs/starship.nix
diff --git a/modules/terminal/system/programs/broot.nix b/modules/terminal/system/programs/broot.nix
index 585e07a..ec20605 100644
--- a/modules/terminal/system/programs/broot.nix
+++ b/modules/terminal/system/programs/broot.nix
@@ -5,9 +5,8 @@
...
}: let
cfg = config.collinux.terminal.shells.fish;
- toml' = pkgs.formats.toml {};
- conf = toml'.generate "conf.toml" {
+ conf = {
verbs = [
{
name = "open-code";
@@ -22,7 +21,10 @@ in
lib.mkIf cfg.enable {
hjem.users."${config.collinux.user.name}" = {
files = {
- ".config/broot/conf.toml".source = conf;
+ ".config/broot/conf.toml" = {
+ generator = (pkgs.formats.toml {}).generate "conf.toml";
+ value = conf;
+ };
".config/fish/conf.d/broot.fish".text = lib.mkIf config.collinux.terminal.shells.fish.enable ''
${pkgs.broot}/bin/broot --print-shell-function fish | source
diff --git a/modules/terminal/system/programs/cmus.nix b/modules/terminal/system/programs/cmus.nix
index 102fa7a..5f7014b 100644
--- a/modules/terminal/system/programs/cmus.nix
+++ b/modules/terminal/system/programs/cmus.nix
@@ -6,7 +6,9 @@
}: let
cfg = config.collinux.terminal.programs.cmus;
- scripts.statusDisplay = pkgs.writeShellScriptBin "status.sh" ''
+ scriptsDir = "~/.config/cmus/scripts";
+
+ scripts.statusDisplay = ''
while [ $# -ge 2 ]; do
eval _$1='$2'
shift
@@ -53,28 +55,37 @@
'';
cmus_rc = ''
- colorscheme catppuccin
- set status_display_program=${scripts.statusDisplay}/bin/status.sh
+ ${
+ if (cfg.theme == "catppuccin")
+ then "colorscheme catppuccin"
+ else ""
+ }
+ set status_display_program=${scriptsDir}/status.sh
'';
- cava_config = ''
- [color]
- gradient=1
- gradient_color_1='#94e2d5'
- gradient_color_2='#89dceb'
- gradient_color_3='#74c7ec'
- gradient_color_4='#89b4fa'
- gradient_color_5='#cba6f7'
- gradient_color_6='#f5c2e7'
- gradient_color_7='#eba0ac'
- gradient_color_8='#f38ba8'
- '';
+ cava_config =
+ if cfg.theme == "catppuccin"
+ then ''
+ [color]
+ gradient=1
+ gradient_color_1='#94e2d5'
+ gradient_color_2='#89dceb'
+ gradient_color_3='#74c7ec'
+ gradient_color_4='#89b4fa'
+ gradient_color_5='#cba6f7'
+ gradient_color_6='#f5c2e7'
+ gradient_color_7='#eba0ac'
+ gradient_color_8='#f38ba8'
+ ''
+ else "";
in
lib.mkIf cfg.enable {
hjem.users."${config.collinux.user.name}" = {
files = {
+ ".config/cmus/scripts/status.sh".text = scripts.statusDisplay;
+
".config/cmus/rc".text = cmus_rc;
- ".config/cmus/catppuccin.theme".text = cmus_theme;
+ ".config/cmus/catppuccin.theme".text = lib.mkIf (cfg.theme == "catppuccin") cmus_theme;
".config/cava/config".text = cava_config;
};
diff --git a/modules/terminal/system/programs/git.nix b/modules/terminal/system/programs/git.nix
index 06801af..9943e40 100644
--- a/modules/terminal/system/programs/git.nix
+++ b/modules/terminal/system/programs/git.nix
@@ -1,26 +1,29 @@
{
config,
+ lib,
pkgs,
...
}: let
cfg = config.collinux.terminal.programs.git;
- git_config = ''
- [alias]
- stage = "add"
- unstage = "restore --staged"
-
- [init]
- defaultBranch = "main"
-
- [user]
- email = "${cfg.userEmail}"
- name = "${cfg.userName}"
- '';
+ git_config = {
+ alias = {
+ stage = "add";
+ unstage = "restore --staged";
+ };
+ init.defaultBranch = "main";
+ user = {
+ email = cfg.userEmail;
+ name = cfg.userName;
+ };
+ };
in {
hjem.users."${config.collinux.user.name}" = {
files = {
- ".config/git/config".text = git_config;
+ ".config/git/config" = {
+ generator = lib.generators.toGitINI;
+ value = git_config;
+ };
};
packages = [pkgs.git];
diff --git a/modules/terminal/system/programs/helix.nix b/modules/terminal/system/programs/helix.nix
index 7bd9af1..358aed3 100644
--- a/modules/terminal/system/programs/helix.nix
+++ b/modules/terminal/system/programs/helix.nix
@@ -5,9 +5,8 @@
...
}: let
cfg = config.collinux.terminal.programs.helix;
- toml' = pkgs.formats.toml {};
- languages = toml'.generate "languages.toml" {
+ languages = {
language-server = {
rust-analyzer.command = "${pkgs.rust-analyzer}/bin/rust-analyzer";
nil.command = "${pkgs.nil}/bin/nil";
@@ -39,7 +38,7 @@
];
};
- customCatppuccinTheme = toml'.generate "catppuccin_mocha_transparent.toml" {
+ theme = {
inherits = "catppuccin_mocha";
"ui.background" = {};
};
@@ -47,82 +46,81 @@
mkHelixConfig = {
theme,
hardMode ? false,
- }:
- toml'.generate "config.toml" {
- inherit theme;
- editor = {
- gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"];
- cursorline = true;
- color-modes = true;
+ }: {
+ inherit theme;
+ editor = {
+ gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"];
+ cursorline = true;
+ color-modes = true;
- mouse = !hardMode;
+ mouse = !hardMode;
- lsp.display-inlay-hints = true;
+ lsp.display-inlay-hints = true;
- statusline = {
- left = ["mode" "file-name" "spacer" "file-modification-indicator"];
- right = ["spinner" "spacer" "workspace-diagnostics" "file-type"];
- separator = "x";
- };
+ statusline = {
+ left = ["mode" "file-name" "spacer" "file-modification-indicator"];
+ right = ["spinner" "spacer" "workspace-diagnostics" "file-type"];
+ separator = "x";
+ };
- cursor-shape = {
- insert = "bar";
- normal = "block";
- select = "underline";
- };
+ cursor-shape = {
+ insert = "bar";
+ normal = "block";
+ select = "underline";
};
- keys = {
- normal =
- {
- "C-space" = "expand_selection";
- "A-j" = ["extend_to_line_bounds" "delete_selection" "paste_after"];
- "A-k" = ["extend_to_line_bounds" "delete_selection" "move_line_up" "paste_before"];
- "X" = ["extend_line_up" "extend_to_line_bounds"];
- "C-left" = "goto_line_start";
- "C-right" = "goto_line_end";
- ";" = "flip_selections";
- "esc" = ["collapse_selection" "keep_primary_selection"];
+ };
+ keys = {
+ normal =
+ {
+ "C-space" = "expand_selection";
+ "A-j" = ["extend_to_line_bounds" "delete_selection" "paste_after"];
+ "A-k" = ["extend_to_line_bounds" "delete_selection" "move_line_up" "paste_before"];
+ "X" = ["extend_line_up" "extend_to_line_bounds"];
+ "C-left" = "goto_line_start";
+ "C-right" = "goto_line_end";
+ ";" = "flip_selections";
+ "esc" = ["collapse_selection" "keep_primary_selection"];
- # I don't even use these anyway
- "pageup" = "no_op";
- "pagedown" = "no_op";
- "home" = "no_op";
- "end" = "no_op";
+ # I don't even use these anyway
+ "pageup" = "no_op";
+ "pagedown" = "no_op";
+ "home" = "no_op";
+ "end" = "no_op";
+ }
+ // (
+ if hardMode
+ then {
+ "up" = "no_op";
+ "down" = "no_op";
+ "left" = "no_op";
+ "right" = "no_op";
}
- // (
- if hardMode
- then {
- "up" = "no_op";
- "down" = "no_op";
- "left" = "no_op";
- "right" = "no_op";
- }
- else {}
- );
+ else {}
+ );
- insert =
- {
- "pageup" = "no_op";
- "pagedown" = "no_op";
- "home" = "no_op";
- "end" = "no_op";
+ insert =
+ {
+ "pageup" = "no_op";
+ "pagedown" = "no_op";
+ "home" = "no_op";
+ "end" = "no_op";
+ }
+ // (
+ if hardMode
+ then {
+ "up" = "no_op";
+ "down" = "no_op";
+ "left" = "no_op";
+ "right" = "no_op";
}
- // (
- if hardMode
- then {
- "up" = "no_op";
- "down" = "no_op";
- "left" = "no_op";
- "right" = "no_op";
- }
- else {}
- );
+ else {}
+ );
- select = {
- "esc" = ["collapse_selection" "insert_mode"];
- };
+ select = {
+ "esc" = ["collapse_selection" "insert_mode"];
};
};
+ };
settings = mkHelixConfig {
inherit (cfg) hardMode;
@@ -136,18 +134,21 @@
in
lib.mkIf cfg.enable {
hjem.users."${config.collinux.user.name}" = {
- files = {
- ".config/helix/config.toml".source = settings;
- ".config/helix/languages.toml".source = languages;
- ".config/helix/themes/catppuccin_mocha_transparent.toml".source = customCatppuccinTheme;
+ files = let
+ t = value: {
+ generator = (pkgs.formats.toml {}).generate "toml_file";
+ inherit value;
+ };
+ in {
+ ".config/helix/config.toml" = t settings;
+ ".config/helix/languages.toml" = t languages;
+ ".config/helix/themes/catppuccin_mocha_transparent.toml" = t theme;
".config/fish/conf.d/helix.fish".text = lib.mkIf config.collinux.terminal.shells.fish.enable ''
set -gx EDITOR hx
'';
};
- packages = [
- pkgs.helix
- ];
+ packages = [pkgs.helix];
};
}
diff --git a/modules/terminal/system/programs/lazygit.nix b/modules/terminal/system/programs/lazygit.nix
index 4c048a0..280ec07 100644
--- a/modules/terminal/system/programs/lazygit.nix
+++ b/modules/terminal/system/programs/lazygit.nix
@@ -5,9 +5,8 @@
...
}: let
cfg = config.collinux.terminal.programs.lazygit;
- yaml' = pkgs.formats.yaml {};
- settings = yaml'.generate "config.yml" {
+ settings = {
git.paging.pager = "${pkgs.diff-so-fancy}/bin/diff-so-fancy";
gui = {
showRandomTip = false;
@@ -18,7 +17,10 @@ in
lib.mkIf cfg.enable {
hjem.users."${config.collinux.user.name}" = {
files = {
- ".config/lazygit/config.yml".source = settings;
+ ".config/lazygit/config.yml" = {
+ generator = lib.generators.toYAML {};
+ value = settings;
+ };
};
packages = [pkgs.lazygit];
diff --git a/modules/terminal/system/programs/nh.nix b/modules/terminal/system/programs/nh.nix
deleted file mode 100644
index 2fcd674..0000000
--- a/modules/terminal/system/programs/nh.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- config,
- lib,
- ...
-}: let
- cfg = config.collinux.terminal.programs.nh;
-in
- lib.mkIf cfg.enable {
- programs.nh = {
- enable = true;
- flake = "/home/collin/nixos";
- clean.enable = true;
- };
- }
diff --git a/modules/terminal/system/programs/starship.nix b/modules/terminal/system/programs/starship.nix
index 748c94e..c70a132 100644
--- a/modules/terminal/system/programs/starship.nix
+++ b/modules/terminal/system/programs/starship.nix
@@ -5,9 +5,8 @@
...
}: let
cfg = config.collinux.terminal.programs.starship;
- toml' = pkgs.formats.toml {};
- settings = toml'.generate "starship.toml" {
+ settings = {
format = ''$directory$git_branch$git_status $character'';
add_newline = false;
@@ -38,7 +37,11 @@ in
lib.mkIf cfg.enable {
hjem.users."${config.collinux.user.name}" = {
files = {
- ".config/starship.toml".source = settings;
+ ".config/starship.toml" = {
+ generator = (pkgs.formats.toml {}).generate "starship.toml";
+ value = settings;
+ };
+
".config/fish/conf.d/starship.fish".text = lib.mkIf config.collinux.terminal.shells.fish.enable ''
function starship_transient_prompt_func
starship module character
diff --git a/modules/terminal/system/programs/tmux.nix b/modules/terminal/system/programs/tmux.nix
index 63b9296..18e1593 100644
--- a/modules/terminal/system/programs/tmux.nix
+++ b/modules/terminal/system/programs/tmux.nix
@@ -132,7 +132,11 @@
set-hook -g window-linked 'if -F "#{==:#{session_windows},1}" { set status off } { set status on }'
set-hook -g window-unlinked 'if -F "#{==:#{session_windows},1}" { set status off } { set status on }'
- run-shell "${scriptsDir}/bar.sh"
+ ${
+ if (cfg.theme == "catppuccin")
+ then "run-shell '${scriptsDir}/bar.sh'"
+ else ""
+ }
# Sessions
set-hook -ag client-detached 'run-shell ${scriptsDir}/clean-sessions.sh'
diff --git a/modules/user/system/default.nix b/modules/user/system/default.nix
index c558090..15252f8 100644
--- a/modules/user/system/default.nix
+++ b/modules/user/system/default.nix
@@ -11,13 +11,14 @@ in {
extraGroups = ["networkmanager" "disks" "input" "video"] ++ (lib.optional cfg.isAdmin "wheel");
hashedPassword = cfg.password;
};
+ security.sudo-rs.enable = true;
- hjem.clobberByDefault = true;
- hjem.users."${cfg.name}" = {
- enable = true;
- directory = "/home/${cfg.name}";
- user = cfg.name;
+ hjem = {
+ clobberByDefault = true;
+ users."${cfg.name}" = {
+ enable = true;
+ directory = "/home/${cfg.name}";
+ user = cfg.name;
+ };
};
-
- security.sudo-rs.enable = true;
}