From 4ef40b5971ad76eaacfde15941deb5399aeb0565 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Thu, 2 Feb 2023 17:30:01 +0100 Subject: [PATCH 01/17] drone: use official drone-scp image again Our PR got accepted and the flag we needed is available now: https://github.com/appleboy/drone-scp/pull/102 --- .drone.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2a9c496d..c554978e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -111,9 +111,8 @@ steps: - nix run nixpkgs#gnused -- --in-place "s/$ISO_NAME/PubSolarOS-latest.iso/" PubSolarOS-latest.iso.sha256 - 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 + # https://github.com/appleboy/drone-scp/pull/141 got merged, yay + image: appleboy/drone-scp:1.6.5-linux-amd64 volumes: - name: file-exchange path: /var/nix/iso-cache @@ -148,6 +147,6 @@ volumes: --- kind: signature -hmac: 0c0994f0878cdb49172772f78c9a772f5c75830b49c1c22bd15db385fe857e17 +hmac: d6187b243c1939eaf2803830e784aa89dd20edda9ba205940cf6caa2c615b6c6 ... From c8435976eb6124ba3d154240806d00e95257534c Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 24 Feb 2023 17:58:21 +0100 Subject: [PATCH 02/17] nvim: fix file preview for names containing spaces --- modules/terminal-life/nvim/preview-file.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/terminal-life/nvim/preview-file.nix b/modules/terminal-life/nvim/preview-file.nix index bc9e9aa5..2a52bdd8 100644 --- a/modules/terminal-life/nvim/preview-file.nix +++ b/modules/terminal-life/nvim/preview-file.nix @@ -31,6 +31,6 @@ with self; '' --style="''${BAT_STYLE:-numbers}" \ --color=always \ --pager=never \ - --file-name=''$FILE \ + --file-name="''$FILE" \ --highlight-line=$CENTER '' From dff81759a87c7ebe595f308a5c3c6f6eda9a131c Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 25 Feb 2023 19:20:16 +0100 Subject: [PATCH 03/17] bash: fix history widget (ctrl+r) unreadable selected entry --- profiles/base-user/session-variables.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/profiles/base-user/session-variables.nix b/profiles/base-user/session-variables.nix index 5bac79c1..fb816046 100644 --- a/profiles/base-user/session-variables.nix +++ b/profiles/base-user/session-variables.nix @@ -83,6 +83,9 @@ # TELEMETRY BS VUEDX_TELEMETRY = "off"; + + # FZF shell history widget default colors + FZF_DEFAULT_OPTS = "--color=bg+:#2d2a2e,bg:#1a181a,spinner:#ef9062,hl:#7accd7 --color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062 --color=marker:#ef9062,fg+:#d3d1d4,prompt:#e5c463,hl+:#7accd7"; }; envListNames = lib.attrsets.mapAttrsToList (name: value: name) variables; From 858fd257a4d36769289849c98f6805076c2304c2 Mon Sep 17 00:00:00 2001 From: Hendrik Sokolowski Date: Mon, 26 Dec 2022 15:08:02 +0100 Subject: [PATCH 04/17] define settings as defaults --- modules/core/boot.nix | 4 ++-- modules/core/services.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/core/boot.nix b/modules/core/boot.nix index 0a7fc412..4f82a4b0 100644 --- a/modules/core/boot.nix +++ b/modules/core/boot.nix @@ -33,10 +33,10 @@ in { }; }; - loader.systemd-boot.enable = true; + loader.systemd-boot.enable = lib.mkDefault true; # Use latest LTS linux kernel by default - kernelPackages = pkgs.linuxPackages_5_15; + kernelPackages = lib.mkDefault pkgs.linuxPackages_5_15; # Support ntfs drives supportedFilesystems = ["ntfs"]; diff --git a/modules/core/services.nix b/modules/core/services.nix index 7a825bc8..2d53dd74 100644 --- a/modules/core/services.nix +++ b/modules/core/services.nix @@ -10,7 +10,7 @@ # 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; + passwordAuthentication = lib.mkDefault false; }; # Service that makes Out of Memory Killer more effective From 1c6a726d0123a9f80aa8afcc24da9b5b857532ed Mon Sep 17 00:00:00 2001 From: Hendrik Sokolowski Date: Mon, 26 Dec 2022 15:06:47 +0100 Subject: [PATCH 05/17] remove packages from lite mode --- modules/terminal-life/default.nix | 1 + modules/terminal-life/nvim/default.nix | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/terminal-life/default.nix b/modules/terminal-life/default.nix index 3b58243f..083f05e9 100644 --- a/modules/terminal-life/default.nix +++ b/modules/terminal-life/default.nix @@ -55,6 +55,7 @@ in { programs.neovim = import ./nvim { inherit config; inherit pkgs; + inherit lib; }; programs.fzf = import ./fzf { inherit config; diff --git a/modules/terminal-life/nvim/default.nix b/modules/terminal-life/nvim/default.nix index 93c8b15b..e1bfd4e6 100644 --- a/modules/terminal-life/nvim/default.nix +++ b/modules/terminal-life/nvim/default.nix @@ -1,6 +1,7 @@ { config, pkgs, + lib, ... }: let psCfg = config.pub-solar; @@ -42,7 +43,8 @@ in { universal-ctags ]; - plugins = with pkgs.vimPlugins; [ + plugins = with pkgs.vimPlugins; [ ] + ++ lib.optionals (!cfg.lite) [ nvim-cmp cmp-nvim-lsp cmp_luasnip From 25126fd8cacaf0b83eca6d56e30a1994bb9a874e Mon Sep 17 00:00:00 2001 From: Hendrik Sokolowski Date: Wed, 2 Nov 2022 20:55:05 +0100 Subject: [PATCH 06/17] Make resumeDevice optional --- modules/core/hibernation.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/core/hibernation.nix b/modules/core/hibernation.nix index c0dd97bb..74befd77 100644 --- a/modules/core/hibernation.nix +++ b/modules/core/hibernation.nix @@ -15,8 +15,8 @@ in { }; resumeDevice = mkOption { - type = types.str; - default = "/dev/sda1"; + type = types.nullOr types.str; + default = null; description = "The location of the hibernation resume swap file."; }; @@ -29,7 +29,7 @@ in { config = { boot = mkIf cfg.enable { - resumeDevice = cfg.resumeDevice; + resumeDevice = mkIf (cfg.resumeDevice != null) cfg.resumeDevice; kernelParams = mkIf (cfg.resumeOffset != null) ["resume_offset=${builtins.toString cfg.resumeOffset}"]; }; }; From a301a91d24b3fdab4673c7f7cddc27545aa2a24e Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 28 Feb 2023 14:00:56 +0100 Subject: [PATCH 07/17] waybar: fix icon size --- profiles/base-user/.config/waybar/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/base-user/.config/waybar/style.css b/profiles/base-user/.config/waybar/style.css index ef85a95a..31b2aab2 100644 --- a/profiles/base-user/.config/waybar/style.css +++ b/profiles/base-user/.config/waybar/style.css @@ -6,7 +6,7 @@ } window#waybar { - font-family: Hack; + font-family: Hack, FontAwesome; font-weight: 500; font-size: 14px; background: rgba(11, 12, 13, 0.90); From a3c4719f9b3eaca57ee96ee83f0d349346b3be10 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 28 Feb 2023 13:59:38 +0100 Subject: [PATCH 08/17] waybar: use nvfetcher to get most recent version from master branch Want improved calendar view on right-click and scrolling through months --- overlays/waybar.nix | 5 +++ pkgs/_sources/generated.nix | 41 +++++++++++++++--------- pkgs/sources.toml | 4 +++ profiles/base-user/.config/waybar/config | 18 +++++++++-- 4 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 overlays/waybar.nix diff --git a/overlays/waybar.nix b/overlays/waybar.nix new file mode 100644 index 00000000..075f5d3e --- /dev/null +++ b/overlays/waybar.nix @@ -0,0 +1,5 @@ +channels: final: prev: { + waybar = channels.latest.waybar.overrideAttrs (oldAttrs: rec { + inherit (prev.sources.waybar-nvfetcher) version src; + }); +} diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix index fb4a336e..addb0e89 100644 --- a/pkgs/_sources/generated.nix +++ b/pkgs/_sources/generated.nix @@ -6,13 +6,13 @@ }: { F-Sy-H = { pname = "F-Sy-H"; - version = "b935a87a75560f8173dd78deee6717c59d464e06"; + version = "899f68b52b6b86a36cd8178eb0e9782d4aeda714"; src = fetchFromGitHub { owner = "z-shell"; repo = "F-Sy-H"; - rev = "b935a87a75560f8173dd78deee6717c59d464e06"; + rev = "899f68b52b6b86a36cd8178eb0e9782d4aeda714"; fetchSubmodules = false; - sha256 = "sha256-448OlDnrDkUjvaSLDhXsa9bkgYXzj1Ju8CTpJVjH8LM="; + sha256 = "sha256-zhaXjrNL0amxexbZm4Kr5Y/feq1+2zW0O6eo9iZhmi0="; }; }; instant-nvim-nvfetcher = { @@ -39,46 +39,46 @@ }; ohmyzsh = { pname = "ohmyzsh"; - version = "65a1e4edbe678cdac37ad96ca4bc4f6d77e27adf"; + version = "b602e0a066d8c98e8c02201ad16c764447fd8531"; src = fetchFromGitHub { owner = "ohmyzsh"; repo = "ohmyzsh"; - rev = "65a1e4edbe678cdac37ad96ca4bc4f6d77e27adf"; + rev = "b602e0a066d8c98e8c02201ad16c764447fd8531"; fetchSubmodules = false; - sha256 = "sha256-qyI7CU0vKhhADZfQtD73GsyAbqdMPhDQ1uA03h4erpw="; + sha256 = "sha256-O4thanOQpX/DHPdfW2p/RUXzIPj6GUp9EnKJfkh7yQM="; }; }; powerlevel10k = { pname = "powerlevel10k"; - version = "8091c8a3a8a845c70046684235a01cd500075def"; + version = "a30145b0f82d06770e924e9eac064ed223a94e6b"; src = fetchFromGitHub { owner = "romkatv"; repo = "powerlevel10k"; - rev = "8091c8a3a8a845c70046684235a01cd500075def"; + rev = "a30145b0f82d06770e924e9eac064ed223a94e6b"; fetchSubmodules = false; - sha256 = "sha256-I0/tktXCbZ3hMYTNvPoWfOEYWRgmHoXsar/jcUB6bpo="; + sha256 = "sha256-jnZXLrywUrJgTX1tFpoNH94r/jcGl2P6R7DoedluHxQ="; }; }; rnix-lsp-nvfetcher = { pname = "rnix-lsp-nvfetcher"; - version = "6925256babec4307479a4080b44f2be38056f210"; + version = "95d40673fe43642e2e1144341e86d0036abd95d9"; src = fetchFromGitHub { owner = "nix-community"; repo = "rnix-lsp"; - rev = "6925256babec4307479a4080b44f2be38056f210"; + rev = "95d40673fe43642e2e1144341e86d0036abd95d9"; fetchSubmodules = false; - sha256 = "sha256-OKLyIXIXhUnRB3Xw+7zI3u6XkwF7Mrbfz1XaasV6i7Q="; + sha256 = "sha256-F0s0m62S5bHNVWNHLZD6SeHiLrsDx98VQbRjDyIu+qQ="; }; }; vim-apprentice-nvfetcher = { pname = "vim-apprentice-nvfetcher"; - version = "9942d0bb0a5d82f7a24450b00051c1f2cc008659"; + version = "59ad13661fa15edaf72c62218903c7817b5a3691"; src = fetchFromGitHub { owner = "romainl"; repo = "Apprentice"; - rev = "9942d0bb0a5d82f7a24450b00051c1f2cc008659"; + rev = "59ad13661fa15edaf72c62218903c7817b5a3691"; fetchSubmodules = false; - sha256 = "sha256-Xs+vTdnihNbBFPOKsW+NB40pqN9eaadqzc0DIeNoOFo="; + sha256 = "sha256-03B9tmU9+6t2hxhOgZxBqJr9r41CAqhHLUkHYvFdcks="; }; }; vim-beautify-nvfetcher = { @@ -125,6 +125,17 @@ sha256 = "sha256-fhazQQqyFaO0fdoeNI9nBshwTDhKNHH262H/QThtuO0="; }; }; + waybar-nvfetcher = { + pname = "waybar-nvfetcher"; + version = "09142fa322e080474de0f2dc3ea98036846550df"; + src = fetchFromGitHub { + owner = "Alexays"; + repo = "Waybar"; + rev = "09142fa322e080474de0f2dc3ea98036846550df"; + fetchSubmodules = false; + sha256 = "sha256-5KqQaaKwW14F/rVWGQ0qBUU0b3Z+v/Mq8lnSwqLtT7U="; + }; + }; zsh-nix-shell = { pname = "zsh-nix-shell"; version = "af6f8a266ea1875b9a3e86e14796cadbe1cfbf08"; diff --git a/pkgs/sources.toml b/pkgs/sources.toml index 5ec5e936..183c914b 100644 --- a/pkgs/sources.toml +++ b/pkgs/sources.toml @@ -46,3 +46,7 @@ fetch.github = "zeekay/vim-beautify" [vim-apprentice-nvfetcher] src.git = "https://github.com/romainl/Apprentice" fetch.github = "romainl/Apprentice" + +[waybar-nvfetcher] +src.git = "https://github.com/Alexays/Waybar" +fetch.github = "Alexays/Waybar" diff --git a/profiles/base-user/.config/waybar/config b/profiles/base-user/.config/waybar/config index 77bb74b8..5dead19b 100644 --- a/profiles/base-user/.config/waybar/config +++ b/profiles/base-user/.config/waybar/config @@ -26,8 +26,22 @@ "spacing": 10 }, "clock": { - "tooltip-format": "{:%Y %B}\n{calendar}", - "format-alt": "{:%a %d. %h %H:%M}" + "tooltip-format": "{calendar}", + "format-alt": "{:%a %d. %h %H:%M}", + //"on-scroll": { + // "calendar": 1 + //} + "calendar": { + "mode-mon-col" : 3, + "on-scroll": -1, + "on-click-right": "mode", + "format": { + "months": "{}", + "days": "{}", + "weekdays": "{}", + "today": "{}" + }, + }, }, "backlight": { // "device": "acpi_video1", From 803c495778838f20a821497d771f70fb4ed10993 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 5 Mar 2023 23:59:24 +0100 Subject: [PATCH 09/17] ci: upload ISO images to bigger /data disk --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index c554978e..35f2e30d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -125,7 +125,7 @@ steps: from_secret: iso_web_ssh_port key: from_secret: iso_web_ssh_key - target: /srv/www/os/download + target: /data/srv/www/os/download source: - /var/nix/iso-cache/*.iso - /var/nix/iso-cache/*.iso.sha256 @@ -147,6 +147,6 @@ volumes: --- kind: signature -hmac: d6187b243c1939eaf2803830e784aa89dd20edda9ba205940cf6caa2c615b6c6 +hmac: 6aee0ffe22111bb629c0a79940bfbc3fa75f68c5ed5c4bba68abf6797b87a7ab ... From 1f5b2b9d10628b3988774eafdcd0c929af2043d5 Mon Sep 17 00:00:00 2001 From: Akshay Mankar Date: Sun, 26 Mar 2023 15:14:33 +0200 Subject: [PATCH 10/17] flake: Remove nur It was perhaps added manually, not sure if the overlay was actually useful to anyone. --- flake.lock | 15 +-------------- flake.nix | 2 -- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index 9602605f..dc21773b 100644 --- a/flake.lock +++ b/flake.lock @@ -282,18 +282,6 @@ "type": "github" } }, - "nur": { - "locked": { - "lastModified": 0, - "narHash": "sha256-koC6DBYmLCrgXA+AMHVaODf1uHYPmvcFygHfy3eg6vI=", - "path": "/nix/store/6mfkswqi67m35qwv0vh7kpk8rypbl2rq-source", - "type": "path" - }, - "original": { - "id": "nur", - "type": "indirect" - } - }, "root": { "inputs": { "agenix": "agenix", @@ -304,8 +292,7 @@ "home": "home", "latest": "latest", "nixos": "nixos", - "nixos-hardware": "nixos-hardware", - "nur": "nur" + "nixos-hardware": "nixos-hardware" } }, "utils": { diff --git a/flake.nix b/flake.nix index d1f2599b..bd494148 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,6 @@ nixos, home, nixos-hardware, - nur, agenix, deploy, ... @@ -76,7 +75,6 @@ our = self.lib; }); }) - nur.overlay agenix.overlays.default (import ./pkgs) From d0470d5aafa7a5778b629bcd1deb51b4be136ea7 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Mon, 27 Mar 2023 13:35:59 +0200 Subject: [PATCH 11/17] flake: pull in changes from digga upstream See: https://github.com/divnix/digga/compare/54ede8e591d288c176a09d6fcf4b123896c0bf0f...0595ae70cdb5ccf1ab031199fe98551c4b378bd9?diff=unified --- default.nix | 1 - doc/api-reference.md | 2 +- doc/book.toml | 6 +++++- doc/concepts/users.md | 17 ++--------------- doc/start/index.md | 32 +++++++++++--------------------- doc/tests.md | 15 ++++++++++++--- lib/default.nix | 10 +++++++++- modules/core/nix.nix | 6 +++--- shell/devos.nix | 31 +++++++++++++------------------ shell/hooks/default.nix | 6 ++++-- 10 files changed, 60 insertions(+), 66 deletions(-) diff --git a/default.nix b/default.nix index 0468b228..3d5b5f96 100644 --- a/default.nix +++ b/default.nix @@ -5,7 +5,6 @@ let ciSystems = [ "aarch64-linux" - "i686-linux" "x86_64-linux" ]; diff --git a/doc/api-reference.md b/doc/api-reference.md index ee2cb9e7..41fa2f78 100755 --- a/doc/api-reference.md +++ b/doc/api-reference.md @@ -59,5 +59,5 @@ list of strings _*Default*_ ``` -["aarch64-linux","aarch64-darwin","i686-linux","x86_64-darwin","x86_64-linux"] +["aarch64-linux","aarch64-darwin","x86_64-darwin","x86_64-linux"] ``` diff --git a/doc/book.toml b/doc/book.toml index f9dca6a3..beb67004 100644 --- a/doc/book.toml +++ b/doc/book.toml @@ -1,5 +1,9 @@ [book] -authors = ["Timothy DeHerrera"] +authors = [ + "Timothy DeHerrera", + "Parthiv Seetharaman", + "David Arnold", +] language = "en" multilingual = false src = "." diff --git a/doc/concepts/users.md b/doc/concepts/users.md index 3cb4480e..85e2f070 100644 --- a/doc/concepts/users.md +++ b/doc/concepts/users.md @@ -9,8 +9,7 @@ Users are a special case of [profiles](profiles.md) that define system users and [home-manager][home-manager] configurations. For your convenience, home manager is wired in by default so all you have to worry about is declaring -your users. For a fully fleshed out example, check out the developers personal -[branch](https://github.com/divnix/devos/tree/nrd/users/nrd/default.nix). +your users. ## Basic Usage @@ -60,18 +59,6 @@ using the `homeConfigurations` flake output. This is great for keeping your environment consistent across Unix-like systems, including macOS. -### From within the projects devshell: - -```sh -# builds the pub-solar user defined in the PubSolarOS host -nix build '.#homeConfigurations."pub-solar@PubSolarOS".activationPackage' - -# build and activate -nix build '.#homeConfigurations."pub-solar@PubSolarOS".activationPackage' && ./result/activate && unlink result -``` - -### Manually from outside the project: - ```sh # build nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPackage" @@ -81,5 +68,5 @@ nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPac ``` [home-manager]: https://nix-community.github.io/home-manager -[modules-list]: https://github.com/divnix/devos/tree/main/users/modules/module-list.nix +[modules-list]: https://github.com/divnix/digga/tree/main/users/modules/module-list.nix [portableuser]: https://digga.divnix.com/api-reference-home.html#homeusers diff --git a/doc/start/index.md b/doc/start/index.md index 06e41292..c160df9f 100644 --- a/doc/start/index.md +++ b/doc/start/index.md @@ -4,7 +4,8 @@ The only dependency is nix, so make sure you have it [installed][install-nix]. ## Get the Template -If you currently don't have flakes setup, you can utilize the digga shell to pull the template: +If you currently don't have flakes setup, you can utilize the digga shell to +pull the template: ```sh nix-shell "https://github.com/divnix/digga/archive/main.tar.gz" \ @@ -22,37 +23,26 @@ Then make sure to create the git repository: ```sh git init git add . -git commit -m init +git commit ``` -To drop into a nix-shell, if you don't have flakes setup, use the digga shell to create a `flake.lock`: - -```sh -nix-shell "https://github.com/divnix/digga/archive/main.tar.gz" \ - --run "nix flake lock" -``` - -Or if you do have flakes support, just run: - -```sh -nix flake lock -``` - -Finally, run `nix-shell` to get to an interactive shell with all the dependencies, including the unstable nix -version required. You can run `menu` to confirm that you are using digga (expected output includes [docs], [general commands], [linter], etc.). +Finally, run `nix-shell` to get to an interactive shell with all the +dependencies, including the unstable nix version required. You can run `menu` to +confirm that you are using digga (expected output includes [docs], [general +commands], [linter], etc.). In addition, the [binary cache](../integrations/cachix.md) is added for faster deployment. -> ##### _Notes:_ +> # _Notes:_ > > - Flakes ignore files that have not been added to git, so be sure to stage new > files before building the system. > - You can choose to simply clone the repo with git if you want to follow > upstream changes. -> - If the `nix-shell -p cachix --run "cachix use nrdxp"` line doesn't work -> you can try with sudo: `sudo nix-shell -p cachix --run "cachix use nrdxp"` +> - If the `nix-shell -p cachix --run "cachix use nrdxp"` line doesn't work you +> can try with sudo: `sudo nix-shell -p cachix --run "cachix use nrdxp"` -## Next Steps: +## Next Steps - [Make installable ISO](./iso.md) diff --git a/doc/tests.md b/doc/tests.md index aa2bda14..24dead09 100644 --- a/doc/tests.md +++ b/doc/tests.md @@ -14,12 +14,21 @@ be built during CI. ## Integration Tests -All your profiles defined in suites will be tested in a NixOS VM. +All your profiles defined in suites can be tested against an individual host. +Simply use digga's pre-baked `digga.lib.allProfilesTest` like so: + +```nix +{ + hosts = { + Morty.tests = [ allProfilesTest ]; + }; +} +``` You can write integration tests for one or more NixOS VMs that can, optionally, be networked together, and yes, it's as awesome as it sounds! -Be sure to use the `mkTest` function from digga, `digga.lib.pkgs-lib.mkTest` +Be sure to use the `mkTest` function from Digga, `digga.lib.mkTest` which wraps the official [testing-python][testing-python] function to ensure that the system is setup exactly as it is for a bare DevOS system. There are already great resources for learning how to use these tests effectively, @@ -28,7 +37,7 @@ and the examples in [nixpkgs][nixos-tests]. [test-doc]: https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests [test-blog]: https://www.haskellforall.com/2020/11/how-to-use-nixos-for-lightweight.html -[default]: https://github.com/divnix/devos/tree/main/tests/default.nix +[default]: https://github.com/divnix/devos/tree/core/tests/default.nix [run-test]: https://github.com/NixOS/nixpkgs/blob/6571462647d7316aff8b8597ecdf5922547bf365/lib/debug.nix#L154-L166 [nixos-tests]: https://github.com/NixOS/nixpkgs/tree/master/nixos/tests [testing-python]: https://github.com/NixOS/nixpkgs/tree/master/nixos/lib/testing-python.nix diff --git a/lib/default.nix b/lib/default.nix index 9bc86f1a..ac167511 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,2 +1,10 @@ {lib}: -lib.makeExtensible (self: {}) +lib.makeExtensible (self: let + callLibs = file: import file {lib = self;}; +in rec { + ## Define your own library functions here! + #id = x: x; + ## Or in files, containing functions that take {lib} + #foo = callLibs ./foo.nix; + ## In configs, they can be used under "lib.our" +}) diff --git a/modules/core/nix.nix b/modules/core/nix.nix index 711304ba..6df8803a 100644 --- a/modules/core/nix.nix +++ b/modules/core/nix.nix @@ -15,10 +15,10 @@ auto-optimise-store = true; # Prevents impurities in builds sandbox = true; - # give root and @wheel special privileges with nix + # Give root and @wheel special privileges with nix trusted-users = ["root" "@wheel"]; - # This is just a representation of the nix default - system-features = ["nixos-test" "benchmark" "big-parallel" "kvm"]; + # Allow only group wheel to connect to the nix daemon + allowed-users = ["@wheel"]; }; # Generally useful nix option defaults extraOptions = '' diff --git a/shell/devos.nix b/shell/devos.nix index c216f3b9..fdbcee2e 100644 --- a/shell/devos.nix +++ b/shell/devos.nix @@ -8,11 +8,11 @@ inherit (pkgs) agenix + alejandra cachix editorconfig-checker - mdbook nix - alejandra + nodePackages nvfetcher shellcheck shfmt @@ -25,21 +25,23 @@ prettier ; - hooks = import ./hooks; - pkgWithCategory = category: package: {inherit package category;}; devos = pkgWithCategory "devos"; - linter = pkgWithCategory "linter"; - docs = pkgWithCategory "docs"; + formatter = pkgWithCategory "linter"; in { - _file = toString ./.; - - imports = ["${extraModulesPath}/git/hooks.nix"]; - git = {inherit hooks;}; + imports = ["${extraModulesPath}/git/hooks.nix" ./hooks]; # override for our own welcome devshell.name = pkgs.lib.mkForce "PubSolarOS"; + packages = [ + alejandra + editorconfig-checker + nodePackages.prettier + shellcheck + shfmt + ]; + commands = with pkgs; [ (devos nix) @@ -50,14 +52,7 @@ in { help = pkgs.nvfetcher.meta.description; command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher}/bin/nvfetcher -c ./sources.toml $@"; } - (linter alejandra) - (linter editorconfig-checker) - (linter nodePackages.prettier) - (linter shfmt) - (linter shellcheck) - (linter treefmt) - - (docs mdbook) + (formatter treefmt) ] ++ lib.optionals (!pkgs.stdenv.buildPlatform.isi686) [ (devos cachix) diff --git a/shell/hooks/default.nix b/shell/hooks/default.nix index 10f2c9d2..1d60d49c 100644 --- a/shell/hooks/default.nix +++ b/shell/hooks/default.nix @@ -1,4 +1,6 @@ { - enable = true; - pre-commit.text = builtins.readFile ./pre-commit.sh; + git.hooks = { + enable = true; + pre-commit.text = builtins.readFile ./pre-commit.sh; + }; } From b01c5f9fced9f154c621853bb98b04b011ec59d8 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Mon, 27 Mar 2023 10:38:24 +0200 Subject: [PATCH 12/17] audio: disable useless bluetooth sap plugin --- modules/audio/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/audio/default.nix b/modules/audio/default.nix index f6d52e71..9a69301b 100644 --- a/modules/audio/default.nix +++ b/modules/audio/default.nix @@ -96,7 +96,13 @@ in { }; # Enable bluetooth - hardware.bluetooth.enable = mkIf cfg.bluetooth.enable true; + hardware.bluetooth = mkIf cfg.bluetooth.enable { + enable = true; + # disable useless SIM Access Profile plugin + disabledPlugins = [ + "sap" + ]; + }; services.blueman.enable = mkIf cfg.bluetooth.enable true; # Enable audio server & client From b1ad71cd35a7c55f7e61fd5981dbdcbfd49f1805 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Mon, 27 Mar 2023 13:36:56 +0200 Subject: [PATCH 13/17] cachix: remove unused binary caches --- flake.nix | 6 +----- profiles/cachix/nix-community.nix | 10 ---------- profiles/cachix/nrdxp.nix | 10 ---------- 3 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 profiles/cachix/nix-community.nix delete mode 100644 profiles/cachix/nrdxp.nix diff --git a/flake.nix b/flake.nix index bd494148..a9a49f7d 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,6 @@ description = "A highly structured configuration database."; nixConfig.extra-experimental-features = "nix-command flakes"; - nixConfig.extra-substituters = "https://nix-dram.cachix.org https://dram.cachix.org https://nrdxp.cachix.org https://nix-community.cachix.org"; - nixConfig.extra-trusted-public-keys = "nix-dram.cachix.org-1:CKjZ0L1ZiqH3kzYAZRt8tg8vewAx5yj8Du/+iR8Efpg= dram.cachix.org-1:baoy1SXpwYdKbqdTbfKGTKauDDeDlHhUpC+QuuILEMY= nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="; inputs = { # Track channels with commits tested and built by hydra @@ -99,9 +97,7 @@ imports = [(digga.lib.importHosts ./hosts)]; hosts = { - /* - set host specific properties here - */ + # Set host-specific properties here bootstrap = { modules = [ digga.nixosModules.bootstrapIso diff --git a/profiles/cachix/nix-community.nix b/profiles/cachix/nix-community.nix deleted file mode 100644 index 3c957fcd..00000000 --- a/profiles/cachix/nix-community.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - nix.settings = { - substituters = [ - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; -} diff --git a/profiles/cachix/nrdxp.nix b/profiles/cachix/nrdxp.nix deleted file mode 100644 index ddced9c3..00000000 --- a/profiles/cachix/nrdxp.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - nix.settings = { - substituters = [ - "https://nrdxp.cachix.org" - ]; - trusted-public-keys = [ - "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4=" - ]; - }; -} From 972e3f1569c6c84c7445c997e189ebe127141649 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Mon, 27 Mar 2023 18:03:28 +0200 Subject: [PATCH 14/17] cachix: default binary cache is nixos.org, no need to specify it explicitly (results in double entry in nix.conf) Also force our nix.extraOptions because digga tries real hard to put their binary caches there: https://github.com/divnix/digga/blob/0595ae70cdb5ccf1ab031199fe98551c4b378bd9/modules/nix-config.nix#L19-L23 --- modules/core/nix.nix | 2 +- profiles/cachix/default.nix | 13 ------------- profiles/full-install/default.nix | 2 -- profiles/pub-solar-iso/default.nix | 1 - 4 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 profiles/cachix/default.nix diff --git a/modules/core/nix.nix b/modules/core/nix.nix index 711304ba..325e20c3 100644 --- a/modules/core/nix.nix +++ b/modules/core/nix.nix @@ -21,7 +21,7 @@ system-features = ["nixos-test" "benchmark" "big-parallel" "kvm"]; }; # Generally useful nix option defaults - extraOptions = '' + extraOptions = lib.mkForce '' min-free = 536870912 keep-outputs = true keep-derivations = true diff --git a/profiles/cachix/default.nix b/profiles/cachix/default.nix deleted file mode 100644 index 9b810da7..00000000 --- a/profiles/cachix/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - pkgs, - lib, - ... -}: let - folder = ./.; - toImport = name: value: folder + ("/" + name); - filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key && key != "default.nix"; - imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); -in { - inherit imports; - nix.settings.substituters = ["https://cache.nixos.org/"]; -} diff --git a/profiles/full-install/default.nix b/profiles/full-install/default.nix index d3c03da7..d9b07733 100644 --- a/profiles/full-install/default.nix +++ b/profiles/full-install/default.nix @@ -7,8 +7,6 @@ }: let inherit (lib) fileContents; in { - imports = [../cachix]; - config = { pub-solar.audio.mopidy.enable = true; pub-solar.audio.bluetooth.enable = true; diff --git a/profiles/pub-solar-iso/default.nix b/profiles/pub-solar-iso/default.nix index 2b3669c5..fa973283 100644 --- a/profiles/pub-solar-iso/default.nix +++ b/profiles/pub-solar-iso/default.nix @@ -7,7 +7,6 @@ }: let inherit (lib) fileContents; in { - imports = [../cachix]; config = { pub-solar.graphical.wayland.software-renderer.enable = true; pub-solar.sway.terminal = "foot"; From 52c2ca9f13b93d7e71925bdf229b80cd8f9fc474 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Mon, 27 Mar 2023 18:53:54 +0200 Subject: [PATCH 15/17] nix.conf: add back required experimental features --- modules/core/nix.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/core/nix.nix b/modules/core/nix.nix index 325e20c3..87182a6e 100644 --- a/modules/core/nix.nix +++ b/modules/core/nix.nix @@ -22,6 +22,7 @@ }; # Generally useful nix option defaults extraOptions = lib.mkForce '' + experimental-features = flakes nix-command min-free = 536870912 keep-outputs = true keep-derivations = true From 3bdc4b1f3989711267e5c6346ad6c0e5dbc02314 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 28 Mar 2023 14:00:07 +0200 Subject: [PATCH 16/17] ci: cleanup unused directories --- .drone/setup_ssh.sh | 11 ---- .drone/upstream-branch.sh | 12 ---- .github/ISSUE_TEMPLATE/bug_report.md | 38 ----------- .github/ISSUE_TEMPLATE/community_request.md | 22 ------- .github/ISSUE_TEMPLATE/feature_request.md | 24 ------- .github/ISSUE_TEMPLATE/upstream_notice.md | 16 ----- .github/workflows/check.yml | 29 --------- .github/workflows/mdbook_docs.yml | 27 -------- .github/workflows/release.yml | 71 --------------------- 9 files changed, 250 deletions(-) delete mode 100755 .drone/setup_ssh.sh delete mode 100755 .drone/upstream-branch.sh delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/community_request.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/upstream_notice.md delete mode 100644 .github/workflows/check.yml delete mode 100644 .github/workflows/mdbook_docs.yml delete mode 100644 .github/workflows/release.yml diff --git a/.drone/setup_ssh.sh b/.drone/setup_ssh.sh deleted file mode 100755 index f4a1bbd4..00000000 --- a/.drone/setup_ssh.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env sh - -set -e - -# Setup ssh inside container -mkdir -p ~/.ssh -echo "$GITEA_SSH_KEY" > ~/.ssh/id_rsa -echo "[git.b12f.io]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ4uaREL7acSSCNAX+voDYl1Kj7JipP62fR5x1UyGP9u" >> ~/.ssh/known_hosts -echo "Host git.b12f.io" >> ~/.ssh/config -echo " Port 2222" >> ~/.ssh/config -chmod -R 600 ~/.ssh diff --git a/.drone/upstream-branch.sh b/.drone/upstream-branch.sh deleted file mode 100755 index a53ad4bb..00000000 --- a/.drone/upstream-branch.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env sh - -set -e -set -u - -LOCAL="$DRONE_BRANCH" -[ "$LOCAL" = "main" ] && UPSTREAM=origin/devos || UPSTREAM=origin/main - -git fetch --all -git checkout "$LOCAL" -git merge "$UPSTREAM" -git push origin "$LOCAL" diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 1040ee63..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help improve -title: '' -labels: 'bug' -assignees: '' - ---- - -Your issue may already be reported! -Please search on the [issue tracker](../) before creating one. - -## Expected Behavior - - - -## Current Behavior - - -## Possible Solution - - - -## Steps to Reproduce - - -1. -2. -3. -4. - -## Context - - - -## Your Environment - - diff --git a/.github/ISSUE_TEMPLATE/community_request.md b/.github/ISSUE_TEMPLATE/community_request.md deleted file mode 100644 index c55a3faf..00000000 --- a/.github/ISSUE_TEMPLATE/community_request.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Commuity Request -about: inspire contribution to the `community` branch -title: '' -labels: 'community' -assignees: '' - ---- - -Your issue may already be reported! -Please search on the [issue tracker](../) before creating one. - -## Ideas - - - - - - -## Requests - - diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 327943c0..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -name: Feature request -about: Suggest an idea -title: '' -labels: 'enhancement' -assignees: '' - ---- - -Your issue may already be reported! -Please search on the [issue tracker](../) before creating one. - -## Would your feature fix an existing issue? - - -## Describe the solution you'd like - - -## Describe alternatives you've considered - - -## Additional context - - diff --git a/.github/ISSUE_TEMPLATE/upstream_notice.md b/.github/ISSUE_TEMPLATE/upstream_notice.md deleted file mode 100644 index 4ada54e3..00000000 --- a/.github/ISSUE_TEMPLATE/upstream_notice.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Upstream notice (Issues or Changes) -about: Create an upstream notice to help our research -title: '[ ]: ' -labels: 'upstream' -assignees: '' - ---- - -## Link - - - -## Context - diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml deleted file mode 100644 index 756aa2bf..00000000 --- a/.github/workflows/check.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: "Check & Cachix" -on: - push: - branches: - - main - - trying - - staging -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - - uses: cachix/install-nix-action@v13 - with: - install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20210415_76980a1/install - extra_nix_config: | - experimental-features = nix-command flakes - system-features = nixos-test benchmark big-parallel kvm recursive-nix - substituters = https://nrdxp.cachix.org https://nix-community.cachix.org https://cache.nixos.org - trusted-public-keys = nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= - - uses: cachix/cachix-action@v10 - with: - name: nrdxp - signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: nix -Lv flake check - - run: nix -Lv build ".#nixosConfigurations.NixOS.config.system.build.toplevel" - - run: nix -Lv develop -c echo OK - - run: nix -Lv develop --command bud --help diff --git a/.github/workflows/mdbook_docs.yml b/.github/workflows/mdbook_docs.yml deleted file mode 100644 index 5faf9c28..00000000 --- a/.github/workflows/mdbook_docs.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Deploy Docs to GitHub Pages - -on: - push: - branches: - - main - -jobs: - deploy: - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - - name: Setup mdBook - uses: peaceiris/actions-mdbook@v1 - with: - mdbook-version: 'latest' - - - run: mdbook build doc - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_branch: gh-pages - publish_dir: ./doc/book - cname: devos.divnix.com diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 8cabd128..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Release - -on: - push: - tags: - - v* - -jobs: - changelog: - name: Update Changelog - runs-on: ubuntu-latest - steps: - - name: Get version from tag - env: - GITHUB_REF: ${{ github.ref }} - run: | - export CURRENT_VERSION=${GITHUB_TAG/refs\/tags\/v/} - echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: main - - name: Update Changelog - uses: heinrichreimer/github-changelog-generator-action@v2.1.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - issues: false - issuesWoLabels: false - pullRequests: true - prWoLabels: true - addSections: '{"documentation":{"prefix":"**Documentation:**","labels":["documentation"]}}' - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Update Changelog for tag ${{ env.CURRENT_VERSION }} - file_pattern: CHANGELOG.md - - release_notes: - name: Create Release Notes - runs-on: ubuntu-latest - needs: changelog - steps: - - name: Get version from tag - env: - GITHUB_REF: ${{ github.ref }} - run: | - export CURRENT_VERSION=${GITHUB_TAG/refs\/tags\/v/} - echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV - - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: main - - - name: Get Changelog Entry - id: changelog_reader - uses: mindsers/changelog-reader-action@v1 - with: - version: ${{ env.CURRENT_VERSION }} - path: ./CHANGELOG.md - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - body: ${{ steps.changelog_reader.outputs.log_entry }} - draft: false - prerelease: false From 3ea141d445f5b3cf0acc7beff6623737d62eb1d6 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 28 Mar 2023 14:03:41 +0200 Subject: [PATCH 17/17] cachix: remove unused binary caches from drone runner --- modules/docker-ci-runner/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/docker-ci-runner/default.nix b/modules/docker-ci-runner/default.nix index 11998fd9..4863d970 100644 --- a/modules/docker-ci-runner/default.nix +++ b/modules/docker-ci-runner/default.nix @@ -23,7 +23,7 @@ let export nix_user_config_file="/home/build/.local/share/nix/trusted-settings.json" mkdir -p $(dirname \\$nix_user_config_file) - echo '{"extra-experimental-features":{"nix-command flakes":true},"extra-substituters":{"https://nix-dram.cachix.org https://dram.cachix.org https://nrdxp.cachix.org https://nix-community.cachix.org":true},"extra-trusted-public-keys":{"nix-dram.cachix.org-1:CKjZ0L1ZiqH3kzYAZRt8tg8vewAx5yj8Du/+iR8Efpg= dram.cachix.org-1:baoy1SXpwYdKbqdTbfKGTKauDDeDlHhUpC+QuuILEMY= nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=":true}}' > \\$nix_user_config_file + echo '{"extra-experimental-features":{"nix-command flakes":true}}' > \\$nix_user_config_file chown -R build /home/build/ curl -L https://github.com/drone-runners/drone-runner-exec/releases/latest/download/drone_runner_exec_linux_amd64.tar.gz | tar xz