diff --git a/.drone.yml b/.drone.yml index b4d4bb92..7da733c4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,12 +1,11 @@ --- kind: pipeline -type: exec +type: docker name: Check -node: - hosttype: baremetal steps: - name: "Check" + image: docker.nix-community.org/nixpkgs/nix-flakes:latest when: event: - pull_request @@ -21,8 +20,6 @@ steps: kind: pipeline type: exec name: Tests -node: - hosttype: baremetal steps: - name: "Tests" @@ -101,19 +98,10 @@ steps: - | nix $$NIX_FLAGS build \ '.#nixosConfigurations.bootstrap.config.system.build.isoImage' - - cp $(readlink -f result)/iso/PubSolarOS*.iso /var/nix/iso-cache/ - - nix shell nixpkgs#findutils - - cd /var/nix/iso-cache/ - - export ISO_NAME=$(find . -name '*.iso' -printf "%f\n") - - sha256sum $ISO_NAME > $ISO_NAME.sha256 - - ln -s $ISO_NAME PubSolarOS-latest.iso - - cp $ISO_NAME.sha256 PubSolarOS-latest.iso.sha256 - - nix run nixpkgs#gnused -- --in-place "s/$ISO_NAME/PubSolarOS-latest.iso/" PubSolarOS-latest.iso.sha256 + - cp $(readlink -f result)/iso/*.iso /var/nix/iso-cache/ - name: "Publish ISO" - # custom drone-scp image, source: https://git.b12f.io/pub-solar/drone-scp/ - # docker build --tag registry.greenbaum.cloud/library/drone-scp:v1.6.5 --file ./docker/Dockerfile.linux.amd64 . - image: registry.greenbaum.cloud/library/drone-scp:v1.6.5 + image: appleboy/drone-scp volumes: - name: file-exchange path: /var/nix/iso-cache @@ -126,11 +114,9 @@ steps: from_secret: iso_web_ssh_port key: from_secret: iso_web_ssh_key - target: /srv/os/download + target: /srv/os source: - /var/nix/iso-cache/*.iso - - /var/nix/iso-cache/*.iso.sha256 - unlink_first: true strip_components: 3 depends_on: @@ -148,6 +134,6 @@ volumes: --- kind: signature -hmac: 291be33bbf2954d1f5e4bf569679e24a773e7d6f90db4765fb9dacb3686a825e +hmac: 2b930bb5fe02006203b7c2fae8af75814749e8cec5f976ec0d6e64eae1b0c5db ... diff --git a/flake.lock b/flake.lock index 060a2aea..794fd6d0 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1665870395, - "narHash": "sha256-Tsbqb27LDNxOoPLh0gw2hIb6L/6Ow/6lIBvqcHzEKBI=", + "lastModified": 1652712410, + "narHash": "sha256-hMJ2TqLt0DleEnQFGUHK9sV2aAzJPU8pZeiZoqRozbE=", "owner": "ryantm", "repo": "agenix", - "rev": "a630400067c6d03c9b3e0455347dc8559db14288", + "rev": "7e5e58b98c3dcbf497543ff6f22591552ebfe65b", "type": "github" }, "original": { @@ -42,11 +42,11 @@ ] }, "locked": { - "lastModified": 1667419884, - "narHash": "sha256-oLNw87ZI5NxTMlNQBv1wG2N27CUzo9admaFlnmavpiY=", + "lastModified": 1661329936, + "narHash": "sha256-dafFjAcJPo0SdegK3E+SnTI8CNMgV/bBm/6CeDf82f8=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "cfc0125eafadc9569d3d6a16ee928375b77e3100", + "rev": "ef0e7f41cdf8fae1d2390c4df246c90a364ed8d9", "type": "github" }, "original": { @@ -192,27 +192,11 @@ "flake-compat_3": { "flake": false, "locked": { - "lastModified": 1650374568, - "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "lastModified": 1648199409, + "narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=", "owner": "edolstra", "repo": "flake-compat", - "rev": "b4a34015c698c7793d592d66adbab377907a2be8", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_4": { - "flake": false, - "locked": { - "lastModified": 1650374568, - "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "rev": "64a525ee38886ab9028e6f61790de0832aa3ef03", "type": "github" }, "original": { @@ -272,11 +256,11 @@ }, "flake-utils_3": { "locked": { - "lastModified": 1667077288, - "narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=", + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", "owner": "numtide", "repo": "flake-utils", - "rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", "type": "github" }, "original": { @@ -292,11 +276,11 @@ ] }, "locked": { - "lastModified": 1667677389, - "narHash": "sha256-y9Zdq8vtsn0T5TO1iTvWA7JndYIAGjzCjbYVi/hOSmA=", + "lastModified": 1656169755, + "narHash": "sha256-Nlnm4jeQWEGjYrE6hxi/7HYHjBSZ/E0RtjCYifnNsWk=", "owner": "nix-community", "repo": "home-manager", - "rev": "87d55517f6f36aa1afbd7a4a064869d5a1d405b8", + "rev": "4a3d01fb53f52ac83194081272795aa4612c2381", "type": "github" }, "original": { @@ -324,11 +308,11 @@ }, "latest_2": { "locked": { - "lastModified": 1667629849, - "narHash": "sha256-P+v+nDOFWicM4wziFK9S/ajF2lc0N2Rg9p6Y35uMoZI=", + "lastModified": 1661361016, + "narHash": "sha256-Bjf6ZDnDc6glTwIIItvwfcaeJ5zWFM6GYfPajSArdUY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3bacde6273b09a21a8ccfba15586fb165078fb62", + "rev": "b784c5ae63dd288375af1b4d37b8a27dd8061887", "type": "github" }, "original": { @@ -345,11 +329,11 @@ ] }, "locked": { - "lastModified": 1662220400, - "narHash": "sha256-9o2OGQqu4xyLZP9K6kNe1pTHnyPz0Wr3raGYnr9AIgY=", + "lastModified": 1659610603, + "narHash": "sha256-LYgASYSPYo7O71WfeUOaEUzYfzuXm8c8eavJcel+pfI=", "owner": "nmattia", "repo": "naersk", - "rev": "6944160c19cb591eb85bbf9b2f2768a935623ed3", + "rev": "c6a45e4277fa58abd524681466d3450f896dc094", "type": "github" }, "original": { @@ -375,11 +359,11 @@ }, "nixos": { "locked": { - "lastModified": 1667653703, - "narHash": "sha256-Xow4vx52/g5zkhlgZnMEm/TEXsj+13jTPCc2jIhW1xU=", + "lastModified": 1661427965, + "narHash": "sha256-LJeSDbiebN0/eRt9vyOm+Bxljdsq5ZdalmmTk9Xpp30=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f09ad462c5a121d0239fde645aacb2221553a217", + "rev": "058de3818577db19d1965c21e2479916a3eaaf95", "type": "github" }, "original": { @@ -395,11 +379,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1666812839, - "narHash": "sha256-0nBDgjPU+iDsvz89W+cDEyhnFGSwCJmwDl/gMGqYiU0=", + "lastModified": 1660727616, + "narHash": "sha256-zYTIvdPMYMx/EYqXODAwIIU30RiEHqNHdgarIHuEYZc=", "owner": "nix-community", "repo": "nixos-generators", - "rev": "41f3518bc194389df22a3d198215eae75e6b5ab9", + "rev": "adccd191a0e83039d537e021f19495b7bad546a1", "type": "github" }, "original": { @@ -410,11 +394,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1667768008, - "narHash": "sha256-PGbX0s2hhXGnZDFVE6UIhPSOf5YegpWs5dUXpT/14F0=", + "lastModified": 1660407119, + "narHash": "sha256-04lWO0pDbhAXFdL4v2VzzwgxrZ5IefKn+TmZPiPeKxg=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "f6483e0def85efb9c1e884efbaff45a5e7aabb34", + "rev": "12620020f76b1b5d2b0e6fbbda831ed4f5fe56e1", "type": "github" }, "original": { @@ -469,18 +453,18 @@ }, "nvfetcher": { "inputs": { - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_3", "flake-utils": "flake-utils_3", "nixpkgs": [ "nixos" ] }, "locked": { - "lastModified": 1667620329, - "narHash": "sha256-v1Zk7rtEbAGpevBGPZvZBKpwbmw4I+uVwxvd+pBlp3o=", + "lastModified": 1654975372, + "narHash": "sha256-wkNZ16akgKViuZzE/IM+bux4uaJ04KIwUeexH8gBjgw=", "owner": "berberman", "repo": "nvfetcher", - "rev": "294826951113dcd3aa9abbcacfb1aa5b95a19116", + "rev": "d4b237c10f14f72f8266b0f658faad822e491e55", "type": "github" }, "original": { @@ -495,7 +479,6 @@ "darwin": "darwin", "deploy": "deploy", "digga": "digga", - "flake-compat": "flake-compat_3", "home": "home", "latest": "latest_2", "naersk": "naersk", diff --git a/flake.nix b/flake.nix index cce3f8ee..4ac60e8a 100644 --- a/flake.nix +++ b/flake.nix @@ -11,9 +11,6 @@ nixos.url = "github:nixos/nixpkgs/nixos-22.05"; latest.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-compat.url = "github:edolstra/flake-compat"; - flake-compat.flake = false; - digga.url = "github:pub-solar/digga/fix/bootstrap-iso"; digga.inputs.nixpkgs.follows = "nixos"; digga.inputs.nixlib.follows = "nixos"; diff --git a/hosts/bootstrap.nix b/hosts/bootstrap.nix index 49422675..7772b0f1 100644 --- a/hosts/bootstrap.nix +++ b/hosts/bootstrap.nix @@ -1,18 +1,4 @@ -{ config, lib, pkgs, profiles, ... }: -with lib; -let - # Gets hostname of host to be bundled inside iso - # Copied from https://github.com/divnix/digga/blob/30ffa0b02272dc56c94fd3c7d8a5a0f07ca197bf/modules/bootstrap-iso.nix#L3-L11 - getFqdn = config: - let - net = config.networking; - fqdn = - if (net ? domain) && (net.domain != null) - then "${net.hostName}.${net.domain}" - else net.hostName; - in - fqdn; -in +{ profiles, ... }: { # build with: `nix build ".#nixosConfigurations.bootstrap.config.system.build.isoImage"` imports = [ @@ -24,28 +10,16 @@ in profiles.pub-solar-iso ]; - config = { - boot.loader.systemd-boot.enable = true; + boot.loader.systemd-boot.enable = true; - # will be overridden by the bootstrapIso instrumentation - fileSystems."/" = { device = "/dev/disk/by-label/nixos"; }; + # will be overridden by the bootstrapIso instrumentation + fileSystems."/" = { device = "/dev/disk/by-label/nixos"; }; - system.nixos.label = "PubSolarOS-" + config.system.nixos.version; - - # mkForce because a similar transformation gets double applied otherwise - # https://github.com/divnix/digga/blob/30ffa0b02272dc56c94fd3c7d8a5a0f07ca197bf/modules/bootstrap-iso.nix#L17 - # https://github.com/NixOS/nixpkgs/blob/aecd4d8349b94f9bd5718c74a5b789f233f67326/nixos/modules/installer/cd-dvd/installation-cd-base.nix#L21-L22 - isoImage = { - isoBaseName = mkForce (getFqdn config); - isoName = mkForce "${config.system.nixos.label}-${config.isoImage.isoBaseName}-${pkgs.stdenv.hostPlatform.system}.iso"; - }; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "21.05"; # Did you read the comment? - }; + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "21.05"; # Did you read the comment? } diff --git a/lib/compat/default.nix b/lib/compat/default.nix index ae3b4426..9d0c2837 100644 --- a/lib/compat/default.nix +++ b/lib/compat/default.nix @@ -1,14 +1,14 @@ let - lock = builtins.fromJSON (builtins.readFile builtins.path { path = ../../flake.lock; name = "lockPath"; }); + rev = "e7e5d481a0e15dcd459396e55327749989e04ce0"; flake = (import ( fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; + url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz"; + sha256 = "0zd3x46fswh5n6faq4x2kkpy6p3c6j593xbdlbsl40ppkclwc80x"; } ) { - src = builtins.path { path = ../../.; name = "projectRoot"; }; + src = ../../.; }); in flake diff --git a/modules/core/boot.nix b/modules/core/boot.nix index cb16865d..10f67dc4 100644 --- a/modules/core/boot.nix +++ b/modules/core/boot.nix @@ -19,7 +19,7 @@ in config = { boot = { # Enable plymouth for better experience of booting - plymouth.enable = mkIf (!cfg.lite) (lib.mkDefault true); + plymouth.enable = true; # Mount / luks device in initrd # Allow fstrim to work on it. diff --git a/modules/core/default.nix b/modules/core/default.nix index 4f74b46d..80ca4926 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -2,6 +2,7 @@ with lib; let + psCfg = config.pub-solar; cfg = config.pub-solar.core; in { @@ -28,12 +29,12 @@ in config = { pub-solar = { - audio.enable = mkIf (!cfg.lite) (mkDefault true); - crypto.enable = mkIf (!cfg.lite) (mkDefault true); - devops.enable = mkIf (!cfg.lite) (mkDefault true); + audio.enable = lib.mkIf (!cfg.lite) true; + crypto.enable = lib.mkIf (!cfg.lite) true; + devops.enable = lib.mkIf (!cfg.lite) true; terminal-life = { - enable = mkDefault true; + enable = true; lite = cfg.lite; }; }; diff --git a/modules/core/hibernation.nix b/modules/core/hibernation.nix index a71ffd37..0454d82b 100644 --- a/modules/core/hibernation.nix +++ b/modules/core/hibernation.nix @@ -27,7 +27,9 @@ in config = { boot = mkIf cfg.enable { resumeDevice = cfg.resumeDevice; - kernelParams = mkIf (cfg.resumeOffset != null) [ "resume_offset=${builtins.toString cfg.resumeOffset}" ]; + kernelParams = + if (cfg.resumeOffset == null && cfg.enable) then builtins.abort "config.pub-solar.resumeOffset has to be set if config.pub-solar.enable is true." + else [ "resume_offset=${builtins.toString cfg.resumeOffset}" ]; }; }; } diff --git a/modules/core/networking.nix b/modules/core/networking.nix index c5ec9cbe..5774f7eb 100644 --- a/modules/core/networking.nix +++ b/modules/core/networking.nix @@ -6,15 +6,6 @@ let cfg = config.pub-solar.core; in { options.pub-solar.core = { - enableCaddy = mkOption { - type = types.bool; - default = !cfg.lite; - }; - enableHelp = mkOption { - type = types.bool; - default = !cfg.lite; - }; - binaryCaches = mkOption { type = types.listOf types.str; default = [ ]; @@ -25,6 +16,11 @@ in default = [ ]; description = "Public keys of binary caches."; }; + iwdConfig = mkOption { + type = with types; nullOr (attrsOf (attrsOf (oneOf [ bool int str ]))); + default = null; + description = "Configuratoin of iNet Wireless Daemon."; + }; }; config = { # disable NetworkManager-wait-online by default @@ -36,46 +32,33 @@ in wifi.backend = "iwd"; }; - networking.firewall.enable = true; - # Customized binary caches list (with fallback to official binary cache) nix.binaryCaches = cfg.binaryCaches; nix.binaryCachePublicKeys = cfg.publicKeys; # These entries get added to /etc/hosts networking.hosts = { - "127.0.0.1" = [ ] - ++ lib.optionals cfg.enableCaddy [ "caddy.local" ] - ++ lib.optionals config.pub-solar.printing.enable [ "cups.local" ] - ++ lib.optionals cfg.enableHelp [ "help.local" ]; + "127.0.0.1" = [ "cups.local" "help.local" "caddy.local" ]; }; # Caddy reverse proxy for local services like cups services.caddy = { - enable = cfg.enableCaddy; + enable = true; globalConfig = '' default_bind 127.0.0.1 auto_https off ''; - extraConfig = concatStringsSep "\n" [ - (lib.optionalString - config.pub-solar.printing.enable - '' - cups.local:80 { - request_header Host localhost:631 - reverse_proxy unix//run/cups/cups.sock - } - '') + extraConfig = '' + cups.local:80 { + request_header Host localhost:631 + reverse_proxy unix//run/cups/cups.sock + } - (lib.optionalString - cfg.enableHelp - '' - help.local:80 { - root * ${pkgs.psos-docs}/lib/html - file_server - } - '') - ]; + help.local:80 { + root * ${pkgs.psos-docs}/lib/html + file_server + } + ''; }; }; } diff --git a/modules/core/services.nix b/modules/core/services.nix index 6ce74472..61ba6ea0 100644 --- a/modules/core/services.nix +++ b/modules/core/services.nix @@ -4,10 +4,7 @@ # For rage encryption, all hosts need a ssh key pair services.openssh = { enable = true; - # If you don't want the host to have SSH actually opened up to the net, - # set `services.openssh.openFirewall` to false in your config. - openFirewall = lib.mkDefault true; - passwordAuthentication = false; + openFirewall = lib.mkDefault false; }; # Service that makes Out of Memory Killer more effective diff --git a/modules/graphical/alacritty.nix b/modules/graphical/alacritty.nix index b389343c..e4e2f6ad 100644 --- a/modules/graphical/alacritty.nix +++ b/modules/graphical/alacritty.nix @@ -100,15 +100,10 @@ foreground = "0xe3e1e4"; }; - # Cursor colors - # - # Colors which should be used to draw the terminal cursor. - # - # Allowed values are CellForeground/CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. + # Colors the cursor will use if `custom_cursor_colors` is true cursor = { - text = "CellBackground"; - cursor = "CellForeground"; + text = "0x1a181a"; + cursor = "0xe3e1e4"; }; # Colors used for the search bar and match highlighting. @@ -120,25 +115,14 @@ background = "0x1a181a"; }; focused_match = { - foreground = "CellBackground"; - background = "CellForeground"; + foreground = "0xe5c463"; + background = "0xe3e1e4"; }; #bar = # background = "#c5c8c6"; # foreground = "#1d1f21"; }; - # Selection colors - # - # Colors which should be used to draw the selection area. - # - # Allowed values are CellForeground/CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - selection = { - text = "0x1a181a"; - background = "0xf85e84"; - }; - # Normal colors normal = { black = "0x1a181a"; diff --git a/modules/paranoia/default.nix b/modules/paranoia/default.nix index 2dc439cf..699ab13e 100644 --- a/modules/paranoia/default.nix +++ b/modules/paranoia/default.nix @@ -21,32 +21,5 @@ in config = mkIf cfg.enable { pub-solar.core.hibernation.enable = true; services.logind.lidSwitch = "hibernate"; - - # The options below are directly taken from or inspired by - # https://xeiaso.net/blog/paranoid-nixos-2021-07-18 - - # Don't set this if you need sftp - services.openssh.allowSFTP = false; - services.openssh.openFirewall = false; # Lock yourself out - - # Limit the use of sudo to the group wheel - security.sudo.execWheelOnly = true; - - # Remove the complete default environment of packages like - # nano, perl and rsync - environment.defaultPackages = lib.mkForce [ ]; - - # fileSystems."/".options = [ "noexec" ]; - - services.openssh = { - kbdInteractiveAuthentication = false; - extraConfig = '' - AllowTcpForwarding yes - X11Forwarding no - AllowAgentForwarding no - AllowStreamLocalForwarding no - AuthenticationMethods publickey - ''; - }; }; } diff --git a/modules/sway/config/config.d/mode_system.conf.nix b/modules/sway/config/config.d/mode_system.conf.nix index f01921c4..f34ecc57 100644 --- a/modules/sway/config/config.d/mode_system.conf.nix +++ b/modules/sway/config/config.d/mode_system.conf.nix @@ -1,22 +1,15 @@ -{ pkgs, psCfg, ... }: '' +{ psCfg, ... }: '' # Set shut down, restart and locking features -'' + (if psCfg.core.hibernation.enable && !psCfg.paranoia.enable then '' - set $mode_system (e)xit, (h)ibernate, (l)ock, (s)uspend, (r)eboot, (Shift+s)hutdown -'' else if psCfg.paranoia.enable then '' set $mode_system (e)xit, (h)ibernate, (r)eboot, (Shift+s)hutdown -'' else '' - set $mode_system (e)xit, (l)ock, (s)uspend, (r)eboot, (Shift+s)hutdown -'') -+ '' bindsym $mod+0 mode "$mode_system" mode "$mode_system" { bindsym e exec swaymsg exit, mode "default" '' + (if psCfg.core.hibernation.enable then '' - bindsym h exec systemctl hibernate, mode "default" + bindsym h exec systemctl hibernate, mode "default" '' else "") + (if !psCfg.paranoia.enable then '' - bindsym l exec ${pkgs.swaylock-bg}/bin/swaylock-bg, mode "default" - bindsym s exec systemctl suspend, mode "default" + bindsym l exec swaylock-bg, mode "default" + bindsym s exec systemctl suspend, mode "default" '' else "") + '' bindsym r exec systemctl reboot, mode "default" bindsym Shift+s exec systemctl poweroff, mode "default" diff --git a/modules/sway/default.nix b/modules/sway/default.nix index c173e9ce..dd0e6055 100644 --- a/modules/sway/default.nix +++ b/modules/sway/default.nix @@ -98,7 +98,7 @@ in xdg.configFile."sway/config.d/theme.conf".source = ./config/config.d/theme.conf; xdg.configFile."sway/config.d/gaps.conf".source = ./config/config.d/gaps.conf; xdg.configFile."sway/config.d/custom-keybindings.conf".source = ./config/config.d/custom-keybindings.conf; - xdg.configFile."sway/config.d/mode_system.conf".text = import ./config/config.d/mode_system.conf.nix { inherit pkgs psCfg; }; + xdg.configFile."sway/config.d/mode_system.conf".text = import ./config/config.d/mode_system.conf.nix { inherit psCfg; }; xdg.configFile."sway/config.d/applications.conf".source = ./config/config.d/applications.conf; xdg.configFile."sway/config.d/systemd.conf".source = ./config/config.d/systemd.conf; }; diff --git a/modules/sway/swayidle.service.nix b/modules/sway/swayidle.service.nix index 80a04518..685d0f1d 100644 --- a/modules/sway/swayidle.service.nix +++ b/modules/sway/swayidle.service.nix @@ -9,14 +9,14 @@ }; Service = { Type = "simple"; - Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin:${pkgs.swaylock-bg}/bin:${pkgs.swayidle}/bin"; - ExecStart = ''swayidle -w \ + Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin"; + ExecStart = ''${pkgs.swayidle}/bin/swayidle -w \ after-resume 'swaymsg "output * dpms on"' \ - before-sleep 'swaylock-bg' '' + (if psCfg.paranoia.enable then '' \ + before-sleep '${pkgs.swaylock-bg}/bin/swaylock-bg' '' + (if psCfg.paranoia.enable then '' \ timeout 120 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ timeout 150 'systemctl hibernate' '' else '' \ - timeout 600 'swaylock-bg' \ + timeout 600 '${pkgs.swaylock-bg}/bin/swaylock-bg' \ timeout 900 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' ''); }; diff --git a/modules/terminal-life/nvim/default.nix b/modules/terminal-life/nvim/default.nix index 4df1892a..bc06943b 100644 --- a/modules/terminal-life/nvim/default.nix +++ b/modules/terminal-life/nvim/default.nix @@ -5,6 +5,66 @@ let xdg = config.home-manager.users."${psCfg.user.name}".xdg; preview-file = pkgs.writeShellScriptBin "preview-file" (import ./preview-file.nix pkgs); + + vimagit-master = pkgs.vimUtils.buildVimPlugin { + name = "vimagit-master"; + src = pkgs.fetchFromGitHub { + owner = "jreybert"; + repo = "vimagit"; + rev = "308650ddc1e9a94e49fae0ea04bbc1c45f23d4c4"; + sha256 = "sha256-fhazQQqyFaO0fdoeNI9nBshwTDhKNHH262H/QThtuO0="; + }; + }; + + instant-nvim = pkgs.vimUtils.buildVimPlugin { + name = "instant"; + src = pkgs.fetchFromGitHub { + owner = "jbyuki"; + repo = "instant.nvim"; + rev = "c02d72267b12130609b7ad39b76cf7f4a3bc9554"; + sha256 = "sha256-7Pr2Au/oGKp5kMXuLsQY4BK5Wny9L1EBdXtyS5EaZPI="; + }; + }; + + vim-caddyfile = pkgs.vimUtils.buildVimPlugin { + name = "vim-caddyfile"; + src = pkgs.fetchFromGitHub { + owner = "isobit"; + repo = "vim-caddyfile"; + rev = "24fe0720551883e407cb70ae1d7c03f162d1d5a0"; + sha256 = "sha256-rRYv3vnt31g7hNTxttTD6BWdv5JJ+ko3rPNyDUEOZ9o="; + }; + }; + + workspace = pkgs.vimUtils.buildVimPlugin { + name = "vim-workspace"; + src = pkgs.fetchFromGitHub { + owner = "thaerkh"; + repo = "vim-workspace"; + rev = "c26b473f9b073f24bacecd38477f44c5cd1f5a62"; + sha256 = "sha256-XV7opLyfkHIDO0+JJaO/x0za0gsHuklrzapTGdLHJmI="; + }; + }; + + beautify = pkgs.vimUtils.buildVimPlugin { + name = "vim-beautify"; + src = pkgs.fetchFromGitHub { + owner = "zeekay"; + repo = "vim-beautify"; + rev = "e0691483927dc5a0c051433602397419f9628623"; + sha256 = "QPTCl6KaGcAjTS5yVDov9yxmv0fDaFoPLMsrtVIG6GQ="; + }; + }; + + apprentice = pkgs.vimUtils.buildVimPlugin { + name = "vim-apprentice"; + src = pkgs.fetchFromGitHub { + owner = "romainl"; + repo = "Apprentice"; + rev = "ecd41698037f15a58125b349be76dbd2595bfb6d"; + sha256 = "sha256-9s7Yzn3IEJBjcyUq9NBIQ9wb45Xr7jOkEIoWf0lAYYg="; + }; + }; in { enable = true; @@ -48,7 +108,7 @@ in lsp_extensions-nvim nvim-lspconfig - instant-nvim-nvfetcher + instant-nvim ack-vim vim-airline @@ -59,23 +119,23 @@ in syntastic vim-gutentags vim-vinegar - vim-workspace-nvfetcher + workspace sonokai vim-hybrid-material vim-airline-themes - vim-apprentice-nvfetcher + apprentice fugitive vim-gitgutter vim-rhubarb - vimagit-nvfetcher + vimagit-master fzf-vim fzfWrapper vim-highlightedyank - vim-beautify-nvfetcher + beautify vim-surround vim-bufkill @@ -84,7 +144,7 @@ in ansible-vim emmet-vim rust-vim - vim-caddyfile-nvfetcher + vim-caddyfile vim-go vim-javascript vim-json diff --git a/modules/terminal-life/zsh/default.nix b/modules/terminal-life/zsh/default.nix index 36ec41ad..b68a4270 100644 --- a/modules/terminal-life/zsh/default.nix +++ b/modules/terminal-life/zsh/default.nix @@ -40,27 +40,46 @@ in myip = "dig +short myip.opendns.com @208.67.222.222 2>&1"; }; plugins = [ - # src gets fetched by nvfetcher, see: ./pkgs/sources.toml { # will source ohmyzsh/plugins/z/ name = "zsh-plugins-z"; - file = "plugins/z/z.plugin.zsh"; - src = pkgs.sources.ohmyzsh.src; + file = "plugins/z/z.sh"; + src = pkgs.fetchFromGitHub { + owner = "ohmyzsh"; + repo = "ohmyzsh"; + rev = "249c708ed3a4a7a63d16a6e911a46b6fb9623cbd"; + sha256 = "sha256-NAVotL5RxpS/zKnO+ngMIjv787lqc1dj/c4blQrQcvU="; + }; } { name = "zsh-powerlevel10k"; file = "powerlevel10k.zsh-theme"; - src = pkgs.sources.powerlevel10k.src; + src = pkgs.fetchFromGitHub { + owner = "romkatv"; + repo = "powerlevel10k"; + rev = "2dd6a29e4d7a33bfef10973d6550e087be37ddee"; + sha256 = "sha256-9vc4cMBCNOmPOyzGwnPeMrXXyQUq4pC9Du3AWl9+Rys="; + }; } { name = "zsh-fast-syntax-highlighting"; file = "F-Sy-H.plugin.zsh"; - src = pkgs.sources.F-Sy-H.src; + src = pkgs.fetchFromGitHub { + owner = "z-shell"; + repo = "F-Sy-H"; + rev = "c4bdc485b67b58351a24f21fcac92c9e0232b939"; + sha256 = "sha256-uXBGIdJwubuueNhQRdGxPUi0eJN17cflYAuHTjeQ8FQ="; + }; } { name = "zsh-nix-shell"; file = "nix-shell.plugin.zsh"; - src = pkgs.sources.zsh-nix-shell.src; + src = pkgs.fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "af6f8a266ea1875b9a3e86e14796cadbe1cfbf08"; + sha256 = "sha256-BjgMhILEL/qdgfno4LR64LSB8n9pC9R+gG7IQWwgyfQ="; + }; } ]; diff --git a/modules/user/default.nix b/modules/user/default.nix index 7c869380..2fd5958e 100644 --- a/modules/user/default.nix +++ b/modules/user/default.nix @@ -23,7 +23,7 @@ in }; publicKeys = mkOption { description = "User SSH public keys"; - type = types.listOf types.str; + type = types.listOf types.path; default = [ ]; }; fullName = mkOption { diff --git a/overlays/neovim-plugins.nix b/overlays/neovim-plugins.nix deleted file mode 100644 index b022049c..00000000 --- a/overlays/neovim-plugins.nix +++ /dev/null @@ -1,22 +0,0 @@ -final: prev: { - vimPlugins = prev.vimPlugins // { - instant-nvim-nvfetcher = prev.vimUtils.buildVimPluginFrom2Nix { - inherit (prev.sources.instant-nvim-nvfetcher) pname version src; - }; - vimagit-nvfetcher = prev.vimUtils.buildVimPluginFrom2Nix { - inherit (prev.sources.vimagit-nvfetcher) pname version src; - }; - vim-caddyfile-nvfetcher = prev.vimUtils.buildVimPluginFrom2Nix { - inherit (prev.sources.vim-caddyfile-nvfetcher) pname version src; - }; - vim-workspace-nvfetcher = prev.vimUtils.buildVimPluginFrom2Nix { - inherit (prev.sources.vim-workspace-nvfetcher) pname version src; - }; - vim-beautify-nvfetcher = prev.vimUtils.buildVimPluginFrom2Nix { - inherit (prev.sources.vim-beautify-nvfetcher) pname version src; - }; - vim-apprentice-nvfetcher = prev.vimUtils.buildVimPluginFrom2Nix { - inherit (prev.sources.vim-apprentice-nvfetcher) pname version src; - }; - }; -} diff --git a/overlays/rnix-lsp.nix b/overlays/rnix-lsp.nix index f755d110..62c0f2b0 100644 --- a/overlays/rnix-lsp.nix +++ b/overlays/rnix-lsp.nix @@ -1,6 +1,13 @@ final: prev: { rnix-lsp = prev.rnix-lsp.overrideAttrs (oldAttrs: rec { - inherit (prev.sources.rnix-lsp-nvfetcher) pname version src; + version = "unstable-2022-07-28"; + + src = prev.fetchFromGitHub { + owner = "nix-community"; + repo = "rnix-lsp"; + rev = "ff18e04551a39ccdab0ff9c83926db3807b23478"; + sha256 = "sha256-4OIpATLdPQvryyhRQPELeqNYC0n6PCyjD6LCPdwOztc="; + }; cargoDeps = oldAttrs.cargoDeps.overrideAttrs (prev.lib.const { name = "rnix-lsp-vendor.tar.gz"; diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix index 30bcbdef..71be3965 100644 --- a/pkgs/_sources/generated.nix +++ b/pkgs/_sources/generated.nix @@ -1,136 +1,16 @@ # This file was generated by nvfetcher, please do not modify it manually. -{ fetchgit, fetchurl, fetchFromGitHub }: +{ fetchgit, fetchurl }: { - F-Sy-H = { - pname = "F-Sy-H"; - version = "b935a87a75560f8173dd78deee6717c59d464e06"; - src = fetchFromGitHub ({ - owner = "z-shell"; - repo = "F-Sy-H"; - rev = "b935a87a75560f8173dd78deee6717c59d464e06"; - fetchSubmodules = false; - sha256 = "sha256-448OlDnrDkUjvaSLDhXsa9bkgYXzj1Ju8CTpJVjH8LM="; - }); - }; - instant-nvim-nvfetcher = { - pname = "instant-nvim-nvfetcher"; - version = "294b6d08143b3db8f9db7f606829270149e1a786"; - src = fetchFromGitHub ({ - owner = "jbyuki"; - repo = "instant.nvim"; - rev = "294b6d08143b3db8f9db7f606829270149e1a786"; - fetchSubmodules = false; - sha256 = "sha256-DXJWji/NR8ZCxe014rD51v3EHJHMhRQeOoI3SsY8mR4="; - }); - }; manix = { pname = "manix"; version = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; - src = fetchFromGitHub ({ - owner = "mlvzk"; - repo = "manix"; + src = fetchgit { + url = "https://github.com/mlvzk/manix"; rev = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; fetchSubmodules = false; - sha256 = "sha256-GqPuYscLhkR5E2HnSFV4R48hCWvtM3C++3zlJhiK/aw="; - }); - }; - ohmyzsh = { - pname = "ohmyzsh"; - version = "65a1e4edbe678cdac37ad96ca4bc4f6d77e27adf"; - src = fetchFromGitHub ({ - owner = "ohmyzsh"; - repo = "ohmyzsh"; - rev = "65a1e4edbe678cdac37ad96ca4bc4f6d77e27adf"; - fetchSubmodules = false; - sha256 = "sha256-qyI7CU0vKhhADZfQtD73GsyAbqdMPhDQ1uA03h4erpw="; - }); - }; - powerlevel10k = { - pname = "powerlevel10k"; - version = "8091c8a3a8a845c70046684235a01cd500075def"; - src = fetchFromGitHub ({ - owner = "romkatv"; - repo = "powerlevel10k"; - rev = "8091c8a3a8a845c70046684235a01cd500075def"; - fetchSubmodules = false; - sha256 = "sha256-I0/tktXCbZ3hMYTNvPoWfOEYWRgmHoXsar/jcUB6bpo="; - }); - }; - rnix-lsp-nvfetcher = { - pname = "rnix-lsp-nvfetcher"; - version = "6925256babec4307479a4080b44f2be38056f210"; - src = fetchFromGitHub ({ - owner = "nix-community"; - repo = "rnix-lsp"; - rev = "6925256babec4307479a4080b44f2be38056f210"; - fetchSubmodules = false; - sha256 = "sha256-OKLyIXIXhUnRB3Xw+7zI3u6XkwF7Mrbfz1XaasV6i7Q="; - }); - }; - vim-apprentice-nvfetcher = { - pname = "vim-apprentice-nvfetcher"; - version = "9942d0bb0a5d82f7a24450b00051c1f2cc008659"; - src = fetchFromGitHub ({ - owner = "romainl"; - repo = "Apprentice"; - rev = "9942d0bb0a5d82f7a24450b00051c1f2cc008659"; - fetchSubmodules = false; - sha256 = "sha256-Xs+vTdnihNbBFPOKsW+NB40pqN9eaadqzc0DIeNoOFo="; - }); - }; - vim-beautify-nvfetcher = { - pname = "vim-beautify-nvfetcher"; - version = "e0691483927dc5a0c051433602397419f9628623"; - src = fetchFromGitHub ({ - owner = "zeekay"; - repo = "vim-beautify"; - rev = "e0691483927dc5a0c051433602397419f9628623"; - fetchSubmodules = false; - sha256 = "sha256-QPTCl6KaGcAjTS5yVDov9yxmv0fDaFoPLMsrtVIG6GQ="; - }); - }; - vim-caddyfile-nvfetcher = { - pname = "vim-caddyfile-nvfetcher"; - version = "24fe0720551883e407cb70ae1d7c03f162d1d5a0"; - src = fetchFromGitHub ({ - owner = "isobit"; - repo = "vim-caddyfile"; - rev = "24fe0720551883e407cb70ae1d7c03f162d1d5a0"; - fetchSubmodules = false; - sha256 = "sha256-rRYv3vnt31g7hNTxttTD6BWdv5JJ+ko3rPNyDUEOZ9o="; - }); - }; - vim-workspace-nvfetcher = { - pname = "vim-workspace-nvfetcher"; - version = "c26b473f9b073f24bacecd38477f44c5cd1f5a62"; - src = fetchFromGitHub ({ - owner = "thaerkh"; - repo = "vim-workspace"; - rev = "c26b473f9b073f24bacecd38477f44c5cd1f5a62"; - fetchSubmodules = false; - sha256 = "sha256-XV7opLyfkHIDO0+JJaO/x0za0gsHuklrzapTGdLHJmI="; - }); - }; - vimagit-nvfetcher = { - pname = "vimagit-nvfetcher"; - version = "308650ddc1e9a94e49fae0ea04bbc1c45f23d4c4"; - src = fetchFromGitHub ({ - owner = "jreybert"; - repo = "vimagit"; - rev = "308650ddc1e9a94e49fae0ea04bbc1c45f23d4c4"; - fetchSubmodules = false; - sha256 = "sha256-fhazQQqyFaO0fdoeNI9nBshwTDhKNHH262H/QThtuO0="; - }); - }; - zsh-nix-shell = { - pname = "zsh-nix-shell"; - version = "af6f8a266ea1875b9a3e86e14796cadbe1cfbf08"; - src = fetchFromGitHub ({ - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "af6f8a266ea1875b9a3e86e14796cadbe1cfbf08"; - fetchSubmodules = false; - sha256 = "sha256-BjgMhILEL/qdgfno4LR64LSB8n9pC9R+gG7IQWwgyfQ="; - }); + deepClone = false; + leaveDotGit = false; + sha256 = "1b7xi8c2drbwzfz70czddc4j33s7g1alirv12dwl91hbqxifx8qs"; + }; }; } diff --git a/pkgs/sources.toml b/pkgs/sources.toml index 5ec5e936..f7af168e 100644 --- a/pkgs/sources.toml +++ b/pkgs/sources.toml @@ -2,47 +2,3 @@ [manix] src.git = "https://github.com/mlvzk/manix" fetch.github = "mlvzk/manix" - -[ohmyzsh] -src.git = "https://github.com/ohmyzsh/ohmyzsh" -fetch.github = "ohmyzsh/ohmyzsh" - -[powerlevel10k] -src.git = "https://github.com/romkatv/powerlevel10k" -fetch.github = "romkatv/powerlevel10k" - -[F-Sy-H] -src.git = "https://github.com/z-shell/F-Sy-H" -fetch.github = "z-shell/F-Sy-H" - -[zsh-nix-shell] -src.git = "https://github.com/chisui/zsh-nix-shell" -fetch.github = "chisui/zsh-nix-shell" - -[rnix-lsp-nvfetcher] -src.git = "https://github.com/nix-community/rnix-lsp" -fetch.github = "nix-community/rnix-lsp" - -[vimagit-nvfetcher] -src.git = "https://github.com/jreybert/vimagit" -fetch.github = "jreybert/vimagit" - -[instant-nvim-nvfetcher] -src.git = "https://github.com/jbyuki/instant.nvim" -fetch.github = "jbyuki/instant.nvim" - -[vim-caddyfile-nvfetcher] -src.git = "https://github.com/isobit/vim-caddyfile" -fetch.github = "isobit/vim-caddyfile" - -[vim-workspace-nvfetcher] -src.git = "https://github.com/thaerkh/vim-workspace" -fetch.github = "thaerkh/vim-workspace" - -[vim-beautify-nvfetcher] -src.git = "https://github.com/zeekay/vim-beautify" -fetch.github = "zeekay/vim-beautify" - -[vim-apprentice-nvfetcher] -src.git = "https://github.com/romainl/Apprentice" -fetch.github = "romainl/Apprentice" diff --git a/profiles/base-user/default.nix b/profiles/base-user/default.nix index 374dca40..9ff21c8e 100644 --- a/profiles/base-user/default.nix +++ b/profiles/base-user/default.nix @@ -25,7 +25,7 @@ in ]; initialHashedPassword = if psCfg.user.password != null then psCfg.user.password else ""; shell = pkgs.zsh; - openssh.authorizedKeys.keys = if psCfg.user.publicKeys != null then psCfg.user.publicKeys else [ ]; + openssh.authorizedKeys.keyFiles = if psCfg.user.publicKeys != null then psCfg.user.publicKeys else [ ]; }; }; } diff --git a/shell/devos.nix b/shell/devos.nix index 382a6d34..9aefcc6f 100644 --- a/shell/devos.nix +++ b/shell/devos.nix @@ -28,6 +28,21 @@ in # override for our own welcome devshell.name = pkgs.lib.mkForce "PubSolarOS"; + # tempfix: remove when merged https://github.com/numtide/devshell/pull/123 + devshell.startup.load_profiles = pkgs.lib.mkForce (pkgs.lib.noDepEntry '' + # PATH is devshell's exorbitant privilige: + # fence against its pollution + _PATH=''${PATH} + # Load installed profiles + for file in "$DEVSHELL_DIR/etc/profile.d/"*.sh; do + # If that folder doesn't exist, bash loves to return the whole glob + [[ -f "$file" ]] && source "$file" + done + # Exert exorbitant privilige and leave no trace + export PATH=''${_PATH} + unset _PATH + ''); + commands = with pkgs; [ (devos nix) (devos agenix)