diff --git a/.gitattributes b/.gitattributes index 0fe79d9..62988e9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ secrets/*.secret filter=git-crypt diff=git-crypt secrets/wireguard.nix filter=git-crypt diff=git-crypt +home/secrets/*.secret filter=git-crypt diff=git-crypt diff --git a/base/gui-programs.nix b/base/gui-programs.nix index 62b386c..f98fedf 100644 --- a/base/gui-programs.nix +++ b/base/gui-programs.nix @@ -3,23 +3,17 @@ environment.systemPackages = with pkgs; [ alacritty discord - emacsPgtkGcc feh firefox - flameshot pavucontrol slack spotify - sqlite # needed for org-roam zathura ]; - fonts.fonts = with pkgs; [ - input-fonts - emacs-all-the-icons-fonts - ]; - networking.networkmanager.enable = true; programs.nm-applet.enable = true; + + # NOTE: needed for home emacs configuration nixpkgs.config.input-fonts.acceptLicense = true; } diff --git a/base/programs.nix b/base/programs.nix index 0770768..2de78f9 100644 --- a/base/programs.nix +++ b/base/programs.nix @@ -14,10 +14,6 @@ AddKeysToAgent yes ''; }; - tmux = { - enable = true; - baseIndex = 1; - }; }; environment.systemPackages = with pkgs; [ diff --git a/boreal.nix b/boreal.nix index 174e1d9..498c76a 100644 --- a/boreal.nix +++ b/boreal.nix @@ -1,11 +1,13 @@ { ... }: - { imports = [ # Default configuration ./base ./base/gui-programs.nix + # Module definitions + ./modules + # Service definitions ./services diff --git a/flake.lock b/flake.lock index 9ea516f..517df23 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "emacs-overlay": { "locked": { - "lastModified": 1618653777, - "narHash": "sha256-jSG1i83pmKwAx6QtkVjyCQT+/LvMEMEVeVDZcOFjRTg=", + "lastModified": 1619028898, + "narHash": "sha256-OgKYwyxZA7zfdanc8RhfZ7OCHlAXHuzN6r4Q6Gjpzlk=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "905883cd5de24958bfd354c6e335f38f667e7ede", + "rev": "e4778461070fb17602e71b01b8beaf7976e5f6ca", "type": "github" }, "original": { @@ -16,6 +16,27 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1618962339, + "narHash": "sha256-Ecud4mXuA96NTCDUWGp5GVVNarZFWZL3YUZ0I8mQKIs=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "db00b39a9abec04245486a01b236b8d9734c9ad0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1618149891, @@ -34,11 +55,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1618072958, - "narHash": "sha256-QDKj58ECixtb4EJMWV5D5Lb2xdCgab1Opi4zjQWbDOg=", + "lastModified": 1619057301, + "narHash": "sha256-1Y1nCnwGSQHM76KGIhz+8tOAGOT3wlP+dKjwoyQXCtg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a73020b2a150322c9832b50baeb0296ba3b13dd7", + "rev": "d235056d6d6dcbd2999bd55fd120d831d4df6304", "type": "github" }, "original": { @@ -51,6 +72,7 @@ "root": { "inputs": { "emacs-overlay": "emacs-overlay", + "home-manager": "home-manager", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } diff --git a/flake.nix b/flake.nix index d8e61ee..d97a6ac 100644 --- a/flake.nix +++ b/flake.nix @@ -1,12 +1,37 @@ { description = "Nixos configuration with flakes"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.09"; - nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; - emacs-overlay.url = "github:nix-community/emacs-overlay/master"; + nixpkgs = { + type = "github"; + owner = "NixOS"; + repo = "nixpkgs"; + ref = "nixos-20.09"; + }; + + nixpkgs-unstable = { + type = "github"; + owner = "NixOS"; + repo = "nixpkgs"; + ref = "nixos-unstable"; + }; + + emacs-overlay = { + type = "github"; + owner = "nix-community"; + repo = "emacs-overlay"; + ref = "master"; + }; + + home-manager = { + type = "github"; + owner = "nix-community"; + repo = "home-manager"; + ref = "master"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; + }; }; - outputs = { self, nixpkgs, nixpkgs-unstable, emacs-overlay }: { + outputs = { self, nixpkgs, nixpkgs-unstable, emacs-overlay, home-manager }: { nixosConfigurations.poseidon = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; modules = @@ -37,10 +62,22 @@ [ ./boreal.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.alarsyo = import ./home; + home-manager.verbose = true; + } + { nixpkgs.overlays = [ emacs-overlay.overlay + (self: super: { + packages = import ./pkgs { pkgs = super; }; + }) + # uncomment this to build everything from scratch, fun but takes a # while # diff --git a/home/alacritty.nix b/home/alacritty.nix new file mode 100644 index 0000000..577140e --- /dev/null +++ b/home/alacritty.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.my.home.alacritty; + alacrittyTheme = config.my.theme.alacrittyTheme; +in +{ + options.my.home.alacritty.enable = lib.mkEnableOption "Alacritty terminal"; + + config = lib.mkIf cfg.enable { + programs.alacritty = { + enable = true; + + settings = { + window = { + padding = { + x = 8; + y = 8; + }; + }; + + font = { + normal = { + family = "Iosevka Fixed"; + style = "Medium"; + }; + size = 10.0; + }; + + colors = alacrittyTheme; + }; + }; + + home.packages = with pkgs; [ + iosevka-bin + ]; + # make sure font is discoverable + fonts.fontconfig.enable = true; + }; +} diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..3be4117 --- /dev/null +++ b/home/default.nix @@ -0,0 +1,18 @@ +{ ... }: +{ + imports = [ + ./alacritty.nix + ./emacs.nix + ./fish + ./flameshot.nix + ./secrets + ./starship.nix + ./themes + ./tmux.nix + ./x + ]; + + home.stateVersion = "20.09"; + + home.username = "alarsyo"; +} diff --git a/home/emacs.nix b/home/emacs.nix new file mode 100644 index 0000000..34d4dab --- /dev/null +++ b/home/emacs.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: +{ + options.my.home.emacs = with lib; { + enable = mkEnableOption "Emacs daemon configuration"; + }; + + config = lib.mkIf config.my.home.emacs.enable { + home.packages = with pkgs; [ + sqlite # needed by org-roam + + # fonts used by my config + emacs-all-the-icons-fonts + iosevka-bin + ]; + # make sure above fonts are discoverable + fonts.fontconfig.enable = true; + + services.emacs = { + enable = true; + # generate emacsclient desktop file + client.enable = true; + }; + + programs.emacs = { + enable = true; + package = pkgs.emacsPgtkGcc; + }; + }; +} diff --git a/home/fish/default.nix b/home/fish/default.nix new file mode 100644 index 0000000..88104e8 --- /dev/null +++ b/home/fish/default.nix @@ -0,0 +1,15 @@ +{ config, lib, ... }: +let + cfg = config.my.home.fish; +in +{ + options.my.home.fish.enable = lib.mkEnableOption "Fish shell"; + + config = lib.mkIf cfg.enable { + programs.fish = { + enable = true; + }; + + xdg.configFile."fish/functions" = { source = ./. + "/functions"; }; + }; +} diff --git a/home/fish/functions/nfl.fish b/home/fish/functions/nfl.fish new file mode 100644 index 0000000..bac1d05 --- /dev/null +++ b/home/fish/functions/nfl.fish @@ -0,0 +1,7 @@ +function nfl + set -l flags "--commit-lock-file" + for flake in $argv + set -a flags "--update-input" "$flake" + end + nix flake lock $flags +end diff --git a/home/flameshot.nix b/home/flameshot.nix new file mode 100644 index 0000000..359fc8c --- /dev/null +++ b/home/flameshot.nix @@ -0,0 +1,13 @@ +{ config, lib, ... }: +let + cfg = config.my.home.flameshot; +in +{ + options.my.home.flameshot = with lib; { + enable = mkEnableOption "flameshot autolaunch"; + }; + + config.services.flameshot = lib.mkIf cfg.enable { + enable = true; + }; +} diff --git a/home/secrets/bluetooth-mouse-mac-address.secret b/home/secrets/bluetooth-mouse-mac-address.secret new file mode 100644 index 0000000..cc6ff3c Binary files /dev/null and b/home/secrets/bluetooth-mouse-mac-address.secret differ diff --git a/home/secrets/default.nix b/home/secrets/default.nix new file mode 100644 index 0000000..71b63a9 --- /dev/null +++ b/home/secrets/default.nix @@ -0,0 +1,13 @@ +{ lib, ... }: +with lib; +{ + options.my.secrets = mkOption { + type = types.attrs; + }; + + config.my.secrets = { + # I'm not sure hiding this is very important, but it *seems* like a bad idea + # to expose this + bluetooth-mouse-mac-address = fileContents ./bluetooth-mouse-mac-address.secret; + }; +} diff --git a/home/starship.nix b/home/starship.nix new file mode 100644 index 0000000..8476c85 --- /dev/null +++ b/home/starship.nix @@ -0,0 +1,17 @@ +{ config, lib, ... }: +let + cfg = config.my.home.starship; +in +{ + options.my.home.starship.enable = lib.mkEnableOption "Starship.rs prompt"; + + config = lib.mkIf cfg.enable { + programs.starship = { + enable = true; + enableFishIntegration = true; + settings = { + add_newline = false; + }; + }; + }; +} diff --git a/home/themes/alacritty.nix b/home/themes/alacritty.nix new file mode 100644 index 0000000..0e1aeb3 --- /dev/null +++ b/home/themes/alacritty.nix @@ -0,0 +1,89 @@ +{ lib }: +with lib; +let + mkColorOption = import ./color.nix { inherit lib; }; + + primaryColorModule = types.submodule { + options = { + background = mkColorOption {}; + foreground = mkColorOption {}; + }; + }; + + cursorColorModule = types.submodule { + options = { + text = mkColorOption {}; + cursor = mkColorOption {}; + }; + }; + + rainbowColorModule = types.submodule { + options = { + black = mkColorOption {}; + red = mkColorOption {}; + green = mkColorOption {}; + yellow = mkColorOption {}; + blue = mkColorOption {}; + magenta = mkColorOption {}; + cyan = mkColorOption {}; + white = mkColorOption {}; + }; + }; +in +types.submodule { + options = { + primary = mkOption { + type = primaryColorModule; + default = { + foreground = "#c5c8c6"; + background = "#1d1f21"; + }; + }; + cursor = mkOption { + type = cursorColorModule; + default = { + text = "#1d1f21"; + cursor = "#c5c8c6"; + }; + }; + normal = mkOption { + type = rainbowColorModule; + default = { + black = "#1d1f21"; + red = "#cc6666"; + green = "#b5bd68"; + yellow = "#f0c674"; + blue = "#81a2be"; + magenta = "#b294bb"; + cyan = "#8abeb7"; + white = "#c5c8c6"; + }; + }; + bright = mkOption { + type = rainbowColorModule; + default = { + black = "#666666"; + red = "#d54e53"; + green = "#b9ca4a"; + yellow = "#e7c547"; + blue = "#7aa6da"; + magenta = "#c397d8"; + cyan = "#70c0b1"; + white = "#eaeaea"; + }; + }; + dim = mkOption { + type = rainbowColorModule; + default = { + black = "#131415"; + red = "#864343"; + green = "#777c44"; + yellow = "#9e824c"; + blue = "#556a7d"; + magenta = "#75617b"; + cyan = "#5b7d78"; + white = "#828482"; + }; + }; + }; +} diff --git a/home/themes/color.nix b/home/themes/color.nix new file mode 100644 index 0000000..46ce77e --- /dev/null +++ b/home/themes/color.nix @@ -0,0 +1,9 @@ +{ lib }: +let + mkColorOption = with lib; {default ? "#000000", description ? "" }: mkOption { + inherit description default; + example = "#abcdef"; + type = types.strMatching "#[0-9a-f]{6}"; + }; +in +mkColorOption diff --git a/home/themes/default.nix b/home/themes/default.nix new file mode 100644 index 0000000..6ce1d1a --- /dev/null +++ b/home/themes/default.nix @@ -0,0 +1,34 @@ +{ config, lib, ... }: +with lib; +let + themeType = types.submodule { + options = { + alacrittyTheme = mkOption { + type = import ./alacritty.nix { inherit lib; }; + default = {}; + }; + i3Theme = mkOption { + type = import ./i3.nix { inherit lib; }; + default = {}; + }; + i3BarTheme = mkOption { + type = import ./i3bar.nix { inherit lib; }; + default = {}; + }; + }; + }; +in +{ + options.my.theme = mkOption { + type = themeType; + default = {}; + }; + + options.my.themes = mkOption { + type = with types; attrsOf themeType; + }; + + config.my.themes = { + solarizedLight = import ./solarizedLight; + }; +} diff --git a/home/themes/i3.nix b/home/themes/i3.nix new file mode 100644 index 0000000..450f26a --- /dev/null +++ b/home/themes/i3.nix @@ -0,0 +1,185 @@ +{ lib }: +with lib; +let + mkColorOption = import ./color.nix { inherit lib; }; + + barColorSetModule = types.submodule { + options = { + border = mkColorOption {}; + background = mkColorOption {}; + text = mkColorOption {}; + }; + }; + + colorSetModule = types.submodule { + options = { + border = mkColorOption {}; + childBorder = mkColorOption {}; + background = mkColorOption {}; + text = mkColorOption {}; + indicator = mkColorOption {}; + }; + }; +in +types.submodule { + options = { + bar = mkOption { + type = types.submodule { + options = { + background = mkColorOption { + default = "#000000"; + description = "Background color of the bar."; + }; + + statusline = mkColorOption { + default = "#ffffff"; + description = "Text color to be used for the statusline."; + }; + + separator = mkColorOption { + default = "#666666"; + description = "Text color to be used for the separator."; + }; + + focusedWorkspace = mkOption { + type = barColorSetModule; + default = { + border = "#4c7899"; + background = "#285577"; + text = "#ffffff"; + }; + description = '' + Border, background and text color for a workspace button when the workspace has focus. + ''; + }; + + activeWorkspace = mkOption { + type = barColorSetModule; + default = { + border = "#333333"; + background = "#5f676a"; + text = "#ffffff"; + }; + description = '' + Border, background and text color for a workspace button when the workspace is active. + ''; + }; + + inactiveWorkspace = mkOption { + type = barColorSetModule; + default = { + border = "#333333"; + background = "#222222"; + text = "#888888"; + }; + description = '' + Border, background and text color for a workspace button when the workspace does not + have focus and is not active. + ''; + }; + + urgentWorkspace = mkOption { + type = barColorSetModule; + default = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + description = '' + Border, background and text color for a workspace button when the workspace contains + a window with the urgency hint set. + ''; + }; + + bindingMode = mkOption { + type = barColorSetModule; + default = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + description = + "Border, background and text color for the binding mode indicator"; + }; + }; + }; + + default = {}; + }; + + background = mkOption { + type = types.str; + default = "#ffffff"; + description = '' + Background color of the window. Only applications which do not cover + the whole area expose the color. + ''; + }; + + focused = mkOption { + type = colorSetModule; + default = { + border = "#4c7899"; + background = "#285577"; + text = "#ffffff"; + indicator = "#2e9ef4"; + childBorder = "#285577"; + }; + description = "A window which currently has the focus."; + }; + + focusedInactive = mkOption { + type = colorSetModule; + default = { + border = "#333333"; + background = "#5f676a"; + text = "#ffffff"; + indicator = "#484e50"; + childBorder = "#5f676a"; + }; + description = '' + A window which is the focused one of its container, + but it does not have the focus at the moment. + ''; + }; + + unfocused = mkOption { + type = colorSetModule; + default = { + border = "#333333"; + background = "#222222"; + text = "#888888"; + indicator = "#292d2e"; + childBorder = "#222222"; + }; + description = "A window which is not focused."; + }; + + urgent = mkOption { + type = colorSetModule; + default = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + indicator = "#900000"; + childBorder = "#900000"; + }; + description = "A window which has its urgency hint activated."; + }; + + placeholder = mkOption { + type = colorSetModule; + default = { + border = "#000000"; + background = "#0c0c0c"; + text = "#ffffff"; + indicator = "#000000"; + childBorder = "#0c0c0c"; + }; + description = '' + Background and text color are used to draw placeholder window + contents (when restoring layouts). Border and indicator are ignored. + ''; + }; + }; +} diff --git a/home/themes/i3bar.nix b/home/themes/i3bar.nix new file mode 100644 index 0000000..990c6d5 --- /dev/null +++ b/home/themes/i3bar.nix @@ -0,0 +1,24 @@ +{ lib }: +with lib; +let + mkColorOption = import ./color.nix { inherit lib; }; +in +types.submodule { + options = { + theme = mkOption { + type = types.submodule { + options = { + name = mkOption { + type = types.str; + default = "plain"; + }; + overrides = mkOption { + type = types.attrsOf types.str; + default = {}; + }; + }; + }; + default = {}; + }; + }; +} diff --git a/home/themes/solarizedLight/alacritty.nix b/home/themes/solarizedLight/alacritty.nix new file mode 100644 index 0000000..9f2149f --- /dev/null +++ b/home/themes/solarizedLight/alacritty.nix @@ -0,0 +1,39 @@ +let + colors = import ./colors.nix; +in +with colors; +{ + primary = { + background = base3; + foreground = base00; + }; + + cursor = { + text = base3; + cursor = base00; + }; + + normal = { + black = base02; + red = red; + green = green; + yellow = yellow; + blue = blue; + magenta = magenta; + cyan = cyan; + white = base2; + }; + + bright = { + black = base03; + red = orange; + green = base01; + yellow = base00; + blue = base0; + magenta = violet; + cyan = base1; + white = base3; + }; + + dim = {}; +} diff --git a/home/themes/solarizedLight/colors.nix b/home/themes/solarizedLight/colors.nix new file mode 100644 index 0000000..f4c69b7 --- /dev/null +++ b/home/themes/solarizedLight/colors.nix @@ -0,0 +1,18 @@ +{ + base03 = "#002b36"; # brblack + base02 = "#073642"; # black + base01 = "#586e75"; # brgreen + base00 = "#657b83"; # bryellow + base0 = "#839496"; # brblue + base1 = "#93a1a1"; # brcyan + base2 = "#eee8d5"; # white + base3 = "#fdf6e3"; # brwhite + yellow = "#b58900"; # yellow + orange = "#cb4b16"; # brred + red = "#dc322f"; # red + magenta = "#d33682"; # magenta + violet = "#6c71c4"; # brmagenta + blue = "#268bd2"; # blue + cyan = "#2aa198"; # cyan + green = "#859900"; # green +} diff --git a/home/themes/solarizedLight/default.nix b/home/themes/solarizedLight/default.nix new file mode 100644 index 0000000..ed22ad4 --- /dev/null +++ b/home/themes/solarizedLight/default.nix @@ -0,0 +1,5 @@ +{ + i3Theme = import ./i3.nix; + i3BarTheme = import ./i3bar.nix; + alacrittyTheme = import ./alacritty.nix; +} diff --git a/home/themes/solarizedLight/i3.nix b/home/themes/solarizedLight/i3.nix new file mode 100644 index 0000000..3eab85d --- /dev/null +++ b/home/themes/solarizedLight/i3.nix @@ -0,0 +1,64 @@ +let + colors = import ./colors.nix; +in +with colors; +{ + bar = { + background = base3; + statusline = yellow; + separator = red; + + focusedWorkspace = { + border = blue; + background = blue; + text = base3; # base2 ? + }; + inactiveWorkspace = { + border = base2; + background = base2; + text = base00; + }; + activeWorkspace = { + border = blue; + background = base2; + text = yellow; + }; + urgentWorkspace = { + border = red; + background = red; + text = base3; + }; + }; + + focused = { + border = blue; + background = blue; + text = base3; + indicator = magenta; + childBorder = blue; + }; + + focusedInactive = { + border = base2; + background = base2; + text = base00; + indicator = magenta; + childBorder = base2; + }; + + unfocused = { + border = base2; + background = base2; + text = base00; + indicator = magenta; + childBorder = base2; + }; + + urgent = { + border = orange; + background = orange; + text = base3; + indicator = magenta; + childBorder = orange; + }; +} diff --git a/home/themes/solarizedLight/i3bar.nix b/home/themes/solarizedLight/i3bar.nix new file mode 100644 index 0000000..69594f4 --- /dev/null +++ b/home/themes/solarizedLight/i3bar.nix @@ -0,0 +1,21 @@ +let + colors = import ./colors.nix; +in +with colors; +{ + theme = { + name = "solarized-light"; + overrides = { + idle_bg = base2; + idle_fg = base00; + info_bg = blue; + info_fg = base3; + good_bg = green; + good_fg = base3; + warning_bg = yellow; + warning_fg = base3; + critical_bg = red; + critical_fg = base3; + }; + }; +} diff --git a/home/tmux.nix b/home/tmux.nix new file mode 100644 index 0000000..b19036a --- /dev/null +++ b/home/tmux.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.my.home.tmux; +in +{ + options.my.home.tmux = with lib; { + enable = mkEnableOption "tmux dotfiles"; + }; + + config.programs.tmux = lib.mkIf cfg.enable { + enable = true; + baseIndex = 1; + terminal = "screen-256color"; + }; +} diff --git a/home/x/cursor.nix b/home/x/cursor.nix new file mode 100644 index 0000000..0b69d47 --- /dev/null +++ b/home/x/cursor.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.my.home.x.cursor; +in +{ + options.my.home.x.cursor.enable = lib.mkEnableOption "X cursor"; + + config = lib.mkIf cfg.enable { + xsession.pointerCursor = { + package = pkgs.capitaine-cursors; + name = "capitaine-cursors"; + # available sizes for capitaine-cursors are: + # 24, 30, 36, 48, 60, 72 + size = 30; + }; + }; +} diff --git a/home/x/default.nix b/home/x/default.nix new file mode 100644 index 0000000..9473fc3 --- /dev/null +++ b/home/x/default.nix @@ -0,0 +1,12 @@ +{ config, lib, pkgs, ... }: +{ + imports = [ + ./cursor.nix + ./i3.nix + ./i3bar.nix + ]; + + options.my.home.x = with lib; { + enable = mkEnableOption "X server configuration"; + }; +} diff --git a/home/x/i3.nix b/home/x/i3.nix new file mode 100644 index 0000000..cc7e231 --- /dev/null +++ b/home/x/i3.nix @@ -0,0 +1,122 @@ +{ config, lib, pkgs, ... }: +let + isEnabled = config.my.home.x.enable; + + myTerminal = + # FIXME: fix when terminal is setup in home + # if config.my.home.terminal.program != null + if true + then "alacritty" + else "i3-sensible-terminal"; + + alt = "Mod1"; # `Alt` key + modifier = "Mod4"; # `Super` key + + logoutMode = "[L]ogout, [S]uspend, [P]oweroff, [R]eboot"; + + i3Theme = config.my.theme.i3Theme; +in +{ + config = lib.mkIf isEnabled { + my.home = { + flameshot.enable = true; + }; + + home.packages = with pkgs; [ + betterlockscreen + ]; + + xsession.windowManager.i3 = { + enable = true; + + config = { + inherit modifier; + + bars = + let + barConfigPath = + config.xdg.configFile."i3status-rust/config-top.toml".target; + in + [ + { + statusCommand = "i3status-rs ${barConfigPath}"; + position = "top"; + fonts = [ "DejaVuSansMono" "FontAwesome5Free 9" ]; + + colors = i3Theme.bar; + } + ]; + + colors = { + inherit (i3Theme) + focused + focusedInactive + unfocused + urgent + ; + }; + + focus = { + followMouse = true; + mouseWarping = true; + }; + + workspaceAutoBackAndForth = true; + + fonts = [ + "DejaVu Sans Mono 8" + ]; + + keybindings = lib.mkOptionDefault { + "${modifier}+Shift+e" = ''mode "${logoutMode}"''; + "${modifier}+i" = "exec emacsclient -c"; + + # Volume handling + "XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%"; + "XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%"; + "XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioMicMute" = "exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle"; + + "${modifier}+l" = "exec --no-startup-id betterlockscreen --lock"; + }; + + modes = + let + makeModeBindings = attrs: attrs // { + "Escape" = "mode default"; + "Return" = "mode default"; + }; + in + lib.mkOptionDefault { + "${logoutMode}" = makeModeBindings { + "l" = "exec --no-startup-id i3-msg exit, mode default"; + "s" = "exec --no-startup-id betterlockscreen --suspend, mode default"; + "p" = "exec --no-startup-id systemctl poweroff, mode default"; + "r" = "exec --no-startup-id systemctl reboot, mode default"; + }; + }; + + startup = [ + # FIXME: make it conditional on "nvidia" being part of video drivers + { + command = "nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=1'"; + notification = false; + } + ]; + + terminal = myTerminal; + + assigns = { + "10" = [ + { class = "Slack"; } + { class = "discord"; } + ]; + }; + + window.commands = [ + { command = "border pixel 2"; criteria = { class = "Alacritty"; }; } + ]; + }; + }; + }; +} diff --git a/home/x/i3bar.nix b/home/x/i3bar.nix new file mode 100644 index 0000000..a9c4b65 --- /dev/null +++ b/home/x/i3bar.nix @@ -0,0 +1,91 @@ +{ config, lib, pkgs, ... }: +let + isEnabled = config.my.home.x.enable; + i3BarTheme = config.my.theme.i3BarTheme; +in +{ + + config = lib.mkIf isEnabled { + home.packages = with pkgs; [ + iw # Used by `net` block + lm_sensors # Used by `temperature` block + font-awesome + ]; + + programs.i3status-rust = { + enable = true; + + bars = { + top = { + icons = "awesome5"; + theme = i3BarTheme.theme.name; + settings = i3BarTheme; + + blocks = [ + { + block = "disk_space"; + path = "/"; + alias = "/"; + info_type = "available"; + unit = "GB"; + interval = 60; + warning = 20.0; + alert = 10.0; + } + # TODO: update to new format when i3status-rust updates to v0.20: + # https://github.com/greshake/i3status-rust/blob/4d55b1d94ee09cbdefd805841fb54a2a4a0663a4/doc/blocks.md#available-format-keys-11 + { + block = "memory"; + display_type = "memory"; + format_mem = "{Mug}/{MTg}GB"; + warning_mem = 70.0; + critical_mem = 90.0; + # don't show swap + clickable = false; + } + { + block = "cpu"; + interval = 1; + format = "{barchart}"; + } + { + block = "temperature"; + collapsed = false; + interval = 10; + format = "{max}°"; + # FIXME: specific to my AMD Ryzen CPU. Make this depend on + # hostname or something else + chip = "k10temp-pci-*"; + inputs = [ "Tccd1" ]; + } + { + block = "networkmanager"; + primary_only = true; + } + { + block = "bluetooth"; + mac = config.my.secrets.bluetooth-mouse-mac-address; + hide_disconnected = true; + # TODO: use format when i3status-rust updates to v0.20 + # format = "{percentage}"; + } + { + block = "sound"; + driver = "pulseaudio"; + } + # { + # block = "notify"; + # } + { + block = "time"; + interval = 5; + format = "%a %d/%m %T"; + locale = "fr_FR"; + timezone = "Europe/Paris"; + } + ]; + }; + }; + }; + }; +} diff --git a/hosts/boreal/default.nix b/hosts/boreal/default.nix index 71615c6..2c6783b 100644 --- a/hosts/boreal/default.nix +++ b/hosts/boreal/default.nix @@ -10,6 +10,8 @@ in imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + + ./home.nix ]; # Use the systemd-boot EFI boot loader. @@ -38,7 +40,7 @@ in # List services that you want to enable: my.services = { wireguard = { - enable = true; + enable = false; iface = "wg"; port = 51820; @@ -69,12 +71,9 @@ in layout = "fr"; xkbVariant = "us"; }; - - emacs = { - enable = true; - package = pkgs.emacsPgtkGcc; - }; }; + my.displayManager.sddm.enable = true; + sound.enable = true; hardware.pulseaudio = { diff --git a/hosts/boreal/home.nix b/hosts/boreal/home.nix new file mode 100644 index 0000000..cd94d72 --- /dev/null +++ b/hosts/boreal/home.nix @@ -0,0 +1,15 @@ +{ config, ... }: +{ + home-manager.users.alarsyo = { + # Keyboard settings & i3 settings + my.home.x.enable = true; + my.home.x.cursor.enable = true; + my.home.alacritty.enable = true; + my.home.emacs.enable = true; + my.home.tmux.enable = true; + my.home.starship.enable = false; + my.home.fish.enable = true; + + my.theme = config.home-manager.users.alarsyo.my.themes.solarizedLight; + }; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..0b7755f --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./sddm.nix + ]; +} diff --git a/modules/sddm.nix b/modules/sddm.nix new file mode 100644 index 0000000..785a681 --- /dev/null +++ b/modules/sddm.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.my.displayManager.sddm; +in +{ + options.my.displayManager.sddm.enable = lib.mkEnableOption "SDDM setup"; + + config = lib.mkIf cfg.enable { + services.xserver.displayManager.sddm = { + enable = true; + theme = "sugar-candy"; + }; + + environment.systemPackages = with pkgs; [ + packages.sddm-sugar-candy + + # dependencies for sugar-candy theme + libsForQt5.qt5.qtgraphicaleffects + libsForQt5.qt5.qtquickcontrols2 + libsForQt5.qt5.qtsvg + ]; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..4b0dc52 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,4 @@ +{ pkgs }: +{ + sddm-sugar-candy = pkgs.callPackage ./sddm-sugar-candy {}; +} diff --git a/pkgs/sddm-sugar-candy/custom-conf.patch b/pkgs/sddm-sugar-candy/custom-conf.patch new file mode 100644 index 0000000..57bd6e2 --- /dev/null +++ b/pkgs/sddm-sugar-candy/custom-conf.patch @@ -0,0 +1,51 @@ +diff --git a/theme.conf b/theme.conf +index f39fb68..8f3256d 100644 +--- a/theme.conf ++++ b/theme.conf +@@ -1,6 +1,6 @@ + [General] + +-Background="Backgrounds/Mountain.jpg" ++Background="Backgrounds/Colorful Dune.jpg" + ## Path relative to the theme root directory. Most standard image file formats are allowed including support for transparency. (e.g. background.jpeg/illustration.GIF/Foto.png/undraw.svgz) + + DimBackgroundImage="0.0" +@@ -9,8 +9,8 @@ DimBackgroundImage="0.0" + ScaleImageCropped="true" + ## Whether the image should be cropped when scaled proportionally. Setting this to false will fit the whole image instead, possibly leaving white space. This can be exploited beautifully with illustrations (try it with "undraw.svg" included in the theme). + +-ScreenWidth="1440" +-ScreenHeight="900" ++ScreenWidth="1920" ++ScreenHeight="1080" + ## Adjust to your resolution to help SDDM speed up on calculations + + +@@ -44,7 +44,7 @@ MainColor="white" + ## Used for all elements when not focused/hovered etc. Usually the best effect is achieved by having this be either white or a very dark grey like #444 (not black for smoother antialias) + ## Colors can be HEX or Qt names (e.g. red/salmon/blanchedalmond). See https://doc.qt.io/qt-5/qml-color.html + +-AccentColor="#fb884f" ++AccentColor="#268bd2" + ## Used for elements in focus/hover/pressed. Should be contrasting to the background and the MainColor to achieve the best effect. + + BackgroundColor="#444" +@@ -84,7 +84,7 @@ ForceLastUser="true" + ForcePasswordFocus="true" + ## Give automatic focus to the password field. Together with ForceLastUser this makes for the fastest login experience. + +-ForceHideCompletePassword="false" ++ForceHideCompletePassword="true" + ## If you don't like to see any character at all not even while being entered set this to true. + + ForceHideVirtualKeyboardButton="false" +@@ -96,7 +96,8 @@ ForceHideSystemButtons="false" + AllowEmptyPassword="false" + ## Enable login for users without a password. This is discouraged. Makes the login button always enabled. + +-AllowBadUsernames="false" ++## set to true to not capitalize my username ++AllowBadUsernames="true" + ## Do not change this! Uppercase letters are generally not allowed in usernames. This option is only for systems that differ from this standard! Also shows username as is instead of capitalized. + + diff --git a/pkgs/sddm-sugar-candy/default.nix b/pkgs/sddm-sugar-candy/default.nix new file mode 100644 index 0000000..e42d3c2 --- /dev/null +++ b/pkgs/sddm-sugar-candy/default.nix @@ -0,0 +1,19 @@ +{ stdenv, fetchFromGitLab }: +stdenv.mkDerivation rec { + pname = "sddm-sugar-candy"; + # latest master commit, no recent tags :( + version = "2b72ef6c6f720fe0ffde5ea5c7c48152e02f6c4f"; + dontBuild = true; + installPhase = '' + mkdir -p $out/share/sddm/themes + cp -aR . $out/share/sddm/themes/sugar-candy + ''; + patches = [ ./custom-conf.patch ]; + src = fetchFromGitLab { + domain = "framagit.org"; + owner = "MarianArlt"; + repo = "sddm-sugar-candy"; + rev = version; + sha256 = "sha256-XggFVsEXLYklrfy1ElkIp9fkTw4wvXbyVkaVCZq4ZLU="; + }; +}