diff --git a/.drone.yml b/.drone.yml index 3b63dc6f..f683f2af 100644 --- a/.drone.yml +++ b/.drone.yml @@ -82,8 +82,82 @@ steps: password: from_secret: matrix_password template: "Upstreaming {{ build.status }} [{{ build.branch }}#{{ truncate build.commit 8 }}]({{ build.link }}) by {{ build.author }}. [Pull requests](https://git.b12f.io/pub-solar/os/pulls)" + +trigger: + event: + - cron + +--- +kind: pipeline +type: docker +name: Check + +steps: + - name: "Check" + image: docker.nix-community.org/nixpkgs/nix-flakes:latest + when: + event: + - pull_request + - tag + environment: + NIX_FLAGS: "--print-build-logs --verbose" + commands: + - 'echo DEBUG: Using NIX_FLAGS: $NIX_FLAGS' + - nix $$NIX_FLAGS flake check + - nix $$NIX_FLAGS build ".#nixosConfigurations.PubSolarOS.config.system.build.toplevel" + - nix $$NIX_FLAGS develop --command echo OK + - nix $$NIX_FLAGS develop --command bud --help + +--- +kind: pipeline +type: docker +name: Publish ISO + +steps: + - name: "Build ISO" + image: docker.nix-community.org/nixpkgs/nix-flakes:latest + volumes: + - name: file-exchange + path: /var/nix/iso-cache + commands: + - | + nix --print-build-logs --verbose \ + develop --command \ + bud build bootstrap bootstrapIso + - cp $(readlink -f result)/iso/*.iso /var/nix/iso-cache/ + + - name: "Publish ISO" + image: appleboy/drone-scp + volumes: + - name: file-exchange + path: /var/nix/iso-cache + settings: + host: + from_secret: ssh_host + user: + from_secret: ssh_user + port: + from_secret: ssh_port + key: + from_secret: ssh_key + target: /var/www/pub.solar + source: + - /var/nix/iso-cache/*.iso + strip_components: 3 + +depends_on: + - Check + +trigger: + event: + - tag + +volumes: + - name: file-exchange + temp: {} + --- kind: signature -hmac: 07d9a95e8f577483d753e9eea76229ffe0c369ecd642bfc364ae183f662d2167 +hmac: e806a6980afdc1bf451be231db1a61e7917822a1f78afe3f2136eadfd632d521 ... diff --git a/.envrc b/.envrc index a6d5743c..e32c27da 100644 --- a/.envrc +++ b/.envrc @@ -1,2 +1,13 @@ +# reload when these files change watch_file shell/* flake.nix use flake || use nix + +#watch_file flake.nix +#watch_file shell.nix +# +#{ +# # shell gc root dir +# mkdir -p "$(direnv_layout_dir)" +# +# eval "$(nix print-dev-env --profile $(direnv_layout_dir)/flake-profile)" +#} || use nix diff --git a/.gitignore b/.gitignore index b8cac1af..37acdb01 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ doi pkgs/_sources/.shake* tags -/owners \ No newline at end of file +/owners diff --git a/README.md b/README.md index 275714ca..e2a83eb9 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,9 @@ expected. There are unstable versions (0._x_._x_) to help users keep track of changes and progress, and a [`develop`](https://github.com/divnix/devos/tree/develop) branch for the brave 😜 ## In the Wild -* The original [authors][please] +* @Pacman99: [Personal](https://gitlab.com/coffeetables/lower), [Server](https://gitlab.com/coffeetables/myrdd) +* [@danielphan2003](https://github.com/danielphan2003/flk) and make sure to also check out [devos-ext-lib][devos-ext-lib] +* [PubSolarOS](https://git.sr.ht/~b12f/pub-solar-os) ## Shoulders This work does not reinvent the wheel. It stands on the [shoulders of the @@ -56,14 +58,15 @@ following giants][giants]: - [devshell](https://github.com/numtide/devshell) ## Divnix -The divnix org is an open space that spontaniously formed out of "the Nix". -It is really just a place where otherwise unrelated people a) get -together and b) stuff done. +The divnix org is an open space that spontaneously formed out of "the Nix". +It is really just a place where otherwise unrelated people work +together and get stuff done. -It's a place to stop "geeking out in isolation" (or within company boundaries), -experiment and learn together and iterate quickly on best practices. That's what it is. +It's a place to stop "geeking out in isolation" (or within company boundaries). +A place to experiment, learn together, and iterate quickly on best practices. +That's what it is. -It might eventually become a non-profit if that's not too complicated or if those +It might eventually become a non-profit if that's not too complicated or, if those goals are sufficiently upstreamed into "the Nix", dissolved. # License @@ -89,3 +92,4 @@ DevOS is licensed under the [MIT License][mit]. [nvfetcher]: https://github.com/berberman/nvfetcher [please]: https://github.com/nrdxp/devos/tree/nrd [matrix]: https://matrix.to/#/#devos:nixos.org +[devos-ext-lib]: https://github.com/divnix/devos-ext-lib diff --git a/doc/concepts/users.md b/doc/concepts/users.md index 3ab7c39c..b2a6c2a3 100644 --- a/doc/concepts/users.md +++ b/doc/concepts/users.md @@ -37,9 +37,10 @@ User profiles can be collected in a similar fashion as system ones into a `suite argument that gets passed to your home-manager users. ### Example +`flake.nix` ```nix { - home-manager.users.nixos = { suites, ... }: { + home.users.nixos = { suites, ... }: { imports = suites.base; }; } diff --git a/doc/secrets.md b/doc/secrets.md index 996f4180..8794925a 100644 --- a/doc/secrets.md +++ b/doc/secrets.md @@ -14,7 +14,7 @@ to easily setup those secret files declaratively. [agenix][agenix] encrypts secrets and stores them as .age files in your repository. Age files are encrypted with multiple ssh public keys, so any host or user with a matching ssh private key can read the data. The [age module][age module] will add those -encrypted files to the nix store and decrypt them on activation to `/run/secrets`. +encrypted files to the nix store and decrypt them on activation to `/run/agenix`. ### Setup All hosts must have openssh enabled, this is done by default in the core profile. @@ -90,7 +90,7 @@ In any profile that uses a NixOS module that requires a secret you can enable a ``` -Then you can just pass the path `/run/secrets/mysecret` to the module. +Then you can just pass the path `/run/agenix/mysecret` to the module. You can make use of the many options provided by the age module to customize where and how secrets get decrypted. You can learn about them by looking at the diff --git a/flake.lock b/flake.lock index dd3ae7e1..8fc8adf4 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1637793790, - "narHash": "sha256-oPXavjxETEWGXq8g7kQHyRLKUmLX2yPtGn+t3V0mrTY=", + "lastModified": 1648942457, + "narHash": "sha256-i29Z1t3sVfCNfpp+KAfeExvpqHQSbLO1KWylTtfradU=", "owner": "ryantm", "repo": "agenix", - "rev": "f85eea0e29fa9a8924571d0e398215e175f80d55", + "rev": "0d5e59ed645e4c7b60174bc6f6aac6a203dc0b01", "type": "github" }, "original": { @@ -23,18 +23,15 @@ "beautysh": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": [ - "bud", - "nixpkgs" - ], + "nixpkgs": "nixpkgs", "poetry2nix": "poetry2nix" }, "locked": { - "lastModified": 1630693543, - "narHash": "sha256-7Sly3ReaJZw60Qo0rpfN4jF6zy94nwQz6ENgUUFzJfg=", + "lastModified": 1641830469, + "narHash": "sha256-uhDmgNP/biOWe4FtOa6c2xZnREH+NP9rdrMm0LccRUk=", "owner": "lovesegfault", "repo": "beautysh", - "rev": "5609593961b70428f58d5c1b4b25cdda43b0d0bd", + "rev": "e85d9736927c0fcf2abb05cb3a2d8d9b4502a2eb", "type": "github" }, "original": { @@ -70,11 +67,11 @@ ] }, "locked": { - "lastModified": 1640836100, - "narHash": "sha256-My9Lay6BCDwAZgrL4SuVXHkYPHIU7ypnuiS/pd7eg1M=", + "lastModified": 1642035816, + "narHash": "sha256-1Lq5c1AeUv/1SK08+O704JVfDdD/zodHzA0cv0TIga8=", "owner": "divnix", "repo": "bud", - "rev": "b1d8ab3970f4dfb5fb90d7d8a9ab493c75d031fc", + "rev": "a789d710851441ba7e7cd59be378623b1fe05688", "type": "github" }, "original": { @@ -90,11 +87,32 @@ ] }, "locked": { - "lastModified": 1634994402, - "narHash": "sha256-xmlCVVOYGpZoxgOqsDOVF0B0ASrnbNGVAEzID9qh2xo=", + "lastModified": 1650976225, + "narHash": "sha256-PGM65SQHS63Dd5MmLJo3GJsZP9lJVZmpWxluQoG1Dt8=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "44da835ac40dab5fd231298b59d83487382d2fab", + "rev": "bb3baef6e115ae47bc2ab4973bd3a486488485b0", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "darwin_2": { + "inputs": { + "nixpkgs": [ + "digga", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1650976225, + "narHash": "sha256-PGM65SQHS63Dd5MmLJo3GJsZP9lJVZmpWxluQoG1Dt8=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "bb3baef6e115ae47bc2ab4973bd3a486488485b0", "type": "github" }, "original": { @@ -105,7 +123,6 @@ }, "deploy": { "inputs": { - "fenix": "fenix", "flake-compat": "flake-compat", "nixpkgs": [ "nixos" @@ -113,26 +130,33 @@ "utils": "utils" }, "locked": { - "lastModified": 1637357482, - "narHash": "sha256-mMRxOlcQs3V9cZYsKGKWEjl+oqclhaH1SKT3QGeTQ0Q=", - "owner": "input-output-hk", + "lastModified": 1648475189, + "narHash": "sha256-gAGAS6IagwoUr1B0ohE3iR6sZ8hP4LSqzYLC8Mq3WGU=", + "owner": "serokell", "repo": "deploy-rs", - "rev": "5a6db26726ec8c7904aea5bcdf13589342386f9d", + "rev": "83e0c78291cd08cb827ba0d553ad9158ae5a95c3", "type": "github" }, "original": { - "owner": "input-output-hk", + "owner": "serokell", "repo": "deploy-rs", "type": "github" } }, "devshell": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "digga", + "nixpkgs" + ] + }, "locked": { - "lastModified": 1637575296, - "narHash": "sha256-ZY8YR5u8aglZPe27+AJMnPTG6645WuavB+w0xmhTarw=", + "lastModified": 1650389807, + "narHash": "sha256-GFRBdHMJ/T/ifaE2GS58RWpxyufH0LqI3oGS6oWAnHk=", "owner": "numtide", "repo": "devshell", - "rev": "0e56ef21ba1a717169953122c7415fa6a8cd2618", + "rev": "5a53bbf3eb4c908d83884d725a86b3a3bde35979", "type": "github" }, "original": { @@ -144,11 +168,12 @@ "digga": { "inputs": { "blank": "blank", + "darwin": "darwin_2", "deploy": [ "deploy" ], "devshell": "devshell", - "flake-utils": "flake-utils_3", + "flake-compat": "flake-compat_2", "flake-utils-plus": "flake-utils-plus", "home-manager": [ "home" @@ -157,17 +182,17 @@ "nixlib": [ "nixos" ], - "nixos-generators": "nixos-generators", "nixpkgs": [ "nixos" - ] + ], + "nixpkgs-unstable": "nixpkgs-unstable" }, "locked": { - "lastModified": 1640031018, - "narHash": "sha256-ZzyS803XuCl99XE4581m0Suni+q1Hz+Mpw6A9bs7VKM=", + "lastModified": 1651210705, + "narHash": "sha256-2RzKrjEnWDhsBQ4Et2gm2LjV5pXyszeqV1xNe+LtNT8=", "owner": "divnix", "repo": "digga", - "rev": "3157889810e51a1ae03f82bf6bf6657ba8cf93c6", + "rev": "0ffa2dff5ede12a03ca83fbc514972f94cf18f42", "type": "github" }, "original": { @@ -176,33 +201,14 @@ "type": "github" } }, - "fenix": { - "inputs": { - "nixpkgs": "nixpkgs_2", - "rust-analyzer-src": "rust-analyzer-src" - }, - "locked": { - "lastModified": 1637303083, - "narHash": "sha256-e2A5JBjxYNpjoGd53K0oVUUaS9ojwOT5rnThyPNS46M=", - "owner": "nix-community", - "repo": "fenix", - "rev": "8294ceadbbbe1a886640bfcc15f5a02a2b471955", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { - "lastModified": 1627913399, - "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", + "lastModified": 1648199409, + "narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=", "owner": "edolstra", "repo": "flake-compat", - "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", + "rev": "64a525ee38886ab9028e6f61790de0832aa3ef03", "type": "github" }, "original": { @@ -214,11 +220,27 @@ "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1627913399, - "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", "owner": "edolstra", "repo": "flake-compat", - "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1648199409, + "narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "64a525ee38886ab9028e6f61790de0832aa3ef03", "type": "github" }, "original": { @@ -229,11 +251,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1623875721, - "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", + "lastModified": 1631561581, + "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", "owner": "numtide", "repo": "flake-utils", - "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", + "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", "type": "github" }, "original": { @@ -244,29 +266,29 @@ }, "flake-utils-plus": { "inputs": { - "flake-utils": "flake-utils_4" + "flake-utils": "flake-utils_3" }, "locked": { - "lastModified": 1638994888, - "narHash": "sha256-iz/ynGNZlvqKCOnFrEKqGA+BVKGQMG+g2JT+e3OOLN8=", - "owner": "divnix", + "lastModified": 1647259887, + "narHash": "sha256-yEkMbEHVO9qydluQ3uHGWX1PkfZhgDKxnd1rhZYZ72w=", + "owner": "gytis-ivaskevicius", "repo": "flake-utils-plus", - "rev": "b4f9f517574cb7bd6ee3f19c72c19634c9f536e1", + "rev": "06dba5f3b4fa2cc0bfc98ce9cd6f9a4d8db11d46", "type": "github" }, "original": { - "owner": "divnix", + "owner": "gytis-ivaskevicius", "repo": "flake-utils-plus", "type": "github" } }, "flake-utils_2": { "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "lastModified": 1642700792, + "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=", "owner": "numtide", "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba", "type": "github" }, "original": { @@ -277,11 +299,11 @@ }, "flake-utils_3": { "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", "owner": "numtide", "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", "type": "github" }, "original": { @@ -292,11 +314,11 @@ }, "flake-utils_4": { "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", "owner": "numtide", "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", "type": "github" }, "original": { @@ -307,11 +329,11 @@ }, "flake-utils_5": { "locked": { - "lastModified": 1631561581, - "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", "owner": "numtide", "repo": "flake-utils", - "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", "type": "github" }, "original": { @@ -327,11 +349,11 @@ ] }, "locked": { - "lastModified": 1637917557, - "narHash": "sha256-3u5bLyGn5NUG3RJA7/v1Bqa/QCFGqp/01Bh/4REf9m4=", + "lastModified": 1651007218, + "narHash": "sha256-NkQAMtqW0PSJTbLHalyZtaqj0ai2TZMOedug9yDIcFw=", "owner": "nix-community", "repo": "home-manager", - "rev": "4daff26495ca9ac67476cba8cf15c3e36d91ab18", + "rev": "d14adb99f3fb562ec74ad18c032efc154b438034", "type": "github" }, "original": { @@ -343,11 +365,11 @@ }, "latest": { "locked": { - "lastModified": 1638198142, - "narHash": "sha256-plU9b8r4St6q4U7VHtG9V7oF8k9fIpfXl/KDaZLuY9k=", + "lastModified": 1650701402, + "narHash": "sha256-XKfstdtqDg+O+gNBx1yGVKWIhLgfEDg/e2lvJSsp9vU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "8a308775674e178495767df90c419425474582a1", + "rev": "bc41b01dd7a9fdffd32d9b03806798797532a5fe", "type": "github" }, "original": { @@ -359,11 +381,11 @@ }, "latest_2": { "locked": { - "lastModified": 1638198142, - "narHash": "sha256-plU9b8r4St6q4U7VHtG9V7oF8k9fIpfXl/KDaZLuY9k=", + "lastModified": 1651007983, + "narHash": "sha256-GNay7yDPtLcRcKCNHldug85AhAvBpTtPEJWSSDYBw8U=", "owner": "nixos", "repo": "nixpkgs", - "rev": "8a308775674e178495767df90c419425474582a1", + "rev": "e10da1c7f542515b609f8dfbcf788f3d85b14936", "type": "github" }, "original": { @@ -380,11 +402,11 @@ ] }, "locked": { - "lastModified": 1638203339, - "narHash": "sha256-Sz3iCvbWrVWOD/XfYQeRJgP/7MVYL3/VKsNXvDeWBFc=", + "lastModified": 1650265945, + "narHash": "sha256-SO8+1db4jTOjnwP++29vVgImLIfETSXyoz0FuLkiikE=", "owner": "nmattia", "repo": "naersk", - "rev": "c3e56b8a4ffb6d906cdfcfee034581f9a8ece571", + "rev": "e8f9f8d037774becd82fce2781e1abdb7836d7df", "type": "github" }, "original": { @@ -393,32 +415,19 @@ "type": "github" } }, - "nixlib": { - "locked": { - "lastModified": 1640478849, - "narHash": "sha256-S4lNc3fb9UpYgVtTa/mZZXphq7+xGy74YGIlOWB1ceE=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "c85a293f7d094a799dcf1197c31925bc44e94d6b", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, "nix-dram": { "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs" + "flake-utils": "flake-utils_4", + "nixpkgs": [ + "latest" + ] }, "locked": { - "lastModified": 1628492639, - "narHash": "sha256-ffF/oEhLs/stAsXXobruKHyH9jnMC2rt/SM3ASrs2U8=", + "lastModified": 1649569158, + "narHash": "sha256-Wtmiyu/1d+3YGGcRxTnQyEtnJaKKR/Ry0kNbOY48Afs=", "owner": "dramforever", "repo": "nix-dram", - "rev": "fba426108ea6bdeb1e362bac9da06cbd33726f41", + "rev": "84c47c0dc93c77f7edfd996f71618d278844c1c4", "type": "github" }, "original": { @@ -427,18 +436,33 @@ "type": "github" } }, + "nixlib": { + "locked": { + "lastModified": 1636849918, + "narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixos": { "locked": { - "lastModified": 1638231428, - "narHash": "sha256-Sm5loBKdeusSvIAC+LtzRT6I7tAcqZdIPnHcxZt7NaE=", + "lastModified": 1651093906, + "narHash": "sha256-kHXSbv+Hc73eV0/JVJ5YsJGr08bA4vJ3/XZew5PgZg0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "393c5357a0071d51668bcdc69dfc25ddacbd5840", + "rev": "feea25c58657fa81d16e0e51f80e1a02ef4cbd49", "type": "github" }, "original": { "owner": "nixos", - "ref": "release-21.11", + "ref": "nixos-21.11", "repo": "nixpkgs", "type": "github" } @@ -446,14 +470,14 @@ "nixos-generators": { "inputs": { "nixlib": "nixlib", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1637655461, - "narHash": "sha256-kXZPbclN3gKwjhp2/RYFDFpAsSBwzX1iLF4EcnHZsPQ=", + "lastModified": 1650997411, + "narHash": "sha256-r4a3qsSv5UTtx+pxTUEdOphBkwTx1+AAVog3c457A0M=", "owner": "nix-community", "repo": "nixos-generators", - "rev": "05a3eb158a9c7746a5d463726d7f7cccf07500e4", + "rev": "3cdf22c79bc80910e2b610cd59fcb8408354ddbc", "type": "github" }, "original": { @@ -464,11 +488,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1638182287, - "narHash": "sha256-vBzf+hbTJz2ZdXV/DWirl6wOO7tjdqzTIU+0FANt65U=", + "lastModified": 1650522846, + "narHash": "sha256-SxWHXRI3qJwswyXAtzsi6PKVY3KLNNnb072KaJthII8=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "6b3f79de09c3de7c91ab51e55e87879f61b6faec", + "rev": "6b4ebea9093c997c5f275c820e679108de4871ab", "type": "github" }, "original": { @@ -479,42 +503,43 @@ }, "nixpkgs": { "locked": { - "lastModified": 1640831728, - "narHash": "sha256-KK5SKqqfAt+ev3bHLrVXJ6i4zx9YQW6k19oUInY8T2M=", + "lastModified": 1633971123, + "narHash": "sha256-WmI4NbH1IPGFWVkuBkKoYgOnxgwSfWDgdZplJlQ93vA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5d90841dd0179430db010dfc2c58b2a7de4371be", + "rev": "e4ef597edfd8a0ba5f12362932fc9b1dd01a0aef", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1650726686, + "narHash": "sha256-hE5PCqQlsdgWH3AUTwesvjZWs5ZUZ8SjMS5cnFB6W54=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3c0f57e36ed0cf9947281e3b31f1bebb7ce5d4a1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1636976544, - "narHash": "sha256-9ZmdyoRz4Qu8bP5BKR1T10YbzcB9nvCeQjOEw2cRKR0=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "931ab058daa7e4cd539533963f95e2bb0dbd41e6", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1640418986, - "narHash": "sha256-a8GGtxn2iL3WAkY5H+4E0s3Q7XJt6bTOvos9qqxT5OQ=", + "lastModified": 1637186689, + "narHash": "sha256-NU7BhgnwA/3ibmCeSzFK6xGi+Bari9mPfn+4cBmyEjw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5c37ad87222cfc1ec36d6cd1364514a9efc2f7f2", + "rev": "7fad01d9d5a3f82081c00fb57918d64145dc904c", "type": "github" }, "original": { @@ -526,12 +551,11 @@ }, "nur": { "locked": { - "lastModified": 1638231901, - "narHash": "sha256-XzuvFTmsXULdWynQWzgaPHikepNhjEpK4o5WXfmRqek=", - "owner": "nix-community", - "repo": "NUR", - "rev": "4e68fb3d8f48e91196deb13f44bcfb421da25afb", - "type": "github" + "lastModified": 1626378135, + "narHash": "sha256-koC6DBYmLCrgXA+AMHVaODf1uHYPmvcFygHfy3eg6vI=", + "path": "/nix/store/6mfkswqi67m35qwv0vh7kpk8rypbl2rq-source", + "rev": "00c2ec8f0bbdf0cfb2135bde55fbae5d6b64aa6d", + "type": "path" }, "original": { "id": "nur", @@ -540,18 +564,18 @@ }, "nvfetcher": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "flake-utils": "flake-utils_5", "nixpkgs": [ "nixos" ] }, "locked": { - "lastModified": 1634524567, - "narHash": "sha256-v9ZTZj1WNQaaVfs1P1mUPuh518mmwpqszj1EjdeGUmc=", + "lastModified": 1650169042, + "narHash": "sha256-x8469XNOU/ebIh5YCuvjcOAaAptwHjkEl1aTFrevu1o=", "owner": "berberman", "repo": "nvfetcher", - "rev": "807513f4bbd0e3b5863f4c3b91f8ac846ed6da9b", + "rev": "db780dba6923e531b5aedca502a36d3d9627fca9", "type": "github" }, "original": { @@ -562,15 +586,23 @@ }, "poetry2nix": { "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs" + "flake-utils": [ + "bud", + "beautysh", + "flake-utils" + ], + "nixpkgs": [ + "bud", + "beautysh", + "nixpkgs" + ] }, "locked": { - "lastModified": 1625240517, - "narHash": "sha256-2E1gaOP+bCplhf3kliVQWK5N1NV2h06mkJk2KTiRTJQ=", + "lastModified": 1633382856, + "narHash": "sha256-hYlet806M9xJj4yxf0g5fhDT2IEUVIMAl7sqIeZ8DUM=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "e40e8ed0e8c11e709e4c8c7c20174facd265a021", + "rev": "705cbfa10e3d9bfed2e59e0256844ae3704dbd7e", "type": "github" }, "original": { @@ -590,40 +622,20 @@ "latest": "latest_2", "naersk": "naersk", "nix-dram": "nix-dram", - "nixlib": [ - "digga", - "nixlib" - ], "nixos": "nixos", + "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", "nur": "nur", "nvfetcher": "nvfetcher" } }, - "rust-analyzer-src": { - "flake": false, - "locked": { - "lastModified": 1637268320, - "narHash": "sha256-lxB1r+7cmZisiGLx0tZ2LaC6X/EcQTbRIWZfnLIIgs4=", - "owner": "rust-analyzer", - "repo": "rust-analyzer", - "rev": "f0da9406bcbde1bc727242b481d8de825e84f59a", - "type": "github" - }, - "original": { - "owner": "rust-analyzer", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } - }, "utils": { "locked": { - "lastModified": 1637014545, - "narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=", + "lastModified": 1648297722, + "narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4", + "rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b50837b4..e9b91fc9 100644 --- a/flake.nix +++ b/flake.nix @@ -2,12 +2,13 @@ description = "A highly structured configuration database."; nixConfig.extra-experimental-features = "nix-command flakes"; - nixConfig.extra-substituters = "https://nrdxp.cachix.org https://nix-community.cachix.org"; - nixConfig.extra-trusted-public-keys = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="; + 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 = { - nixos.url = "github:nixos/nixpkgs/release-21.11"; + # Track channels with commits tested and built by hydra + nixos.url = "github:nixos/nixpkgs/nixos-21.11"; latest.url = "github:nixos/nixpkgs/nixos-unstable"; digga.url = "github:divnix/digga"; @@ -26,7 +27,7 @@ darwin.url = "github:LnL7/nix-darwin"; darwin.inputs.nixpkgs.follows = "nixos"; - deploy.url = "github:input-output-hk/deploy-rs"; + deploy.url = "github:serokell/deploy-rs"; deploy.inputs.nixpkgs.follows = "nixos"; agenix.url = "github:ryantm/agenix"; @@ -40,8 +41,11 @@ nixos-hardware.url = "github:nixos/nixos-hardware"; + nixos-generators.url = "github:nix-community/nixos-generators"; + # PubSolarOS additions nix-dram.url = "github:dramforever/nix-dram"; + nix-dram.inputs.nixpkgs.follows = "latest"; }; outputs = @@ -64,6 +68,8 @@ channelsConfig = { allowUnfree = true; }; + supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; + channels = { nixos = { imports = [ (digga.lib.importOverlays ./overlays) ]; @@ -71,7 +77,6 @@ nur.overlay agenix.overlay nvfetcher.overlay - nix-dram.overlay ./pkgs/default.nix ]; }; @@ -107,16 +112,17 @@ imports = [ (digga.lib.importHosts ./hosts) ]; hosts = { /* set host specific properties here */ - NixOS = { }; + PubSolarOS = { }; }; importables = rec { profiles = digga.lib.rakeLeaves ./profiles // { users = digga.lib.rakeLeaves ./users; }; suites = with profiles; rec { - base = [ core users.nixos users.root ]; - pubsolaros = [ core base-user users.root ]; - anonymous = [ pubsolaros users.nixos ]; + base = [ core users.pub-solar users.root ]; + iso = base ++ [ base-user graphical pub-solar-iso ]; + pubsolaros = [ core full-install base-user users.root ]; + anonymous = [ pubsolaros users.pub-solar ]; }; }; }; @@ -131,7 +137,7 @@ }; }; users = { - nixos = { suites, ... }: { imports = suites.base; }; + pub-solar = { suites, ... }: { imports = suites.base; }; }; # digga.lib.importers.rakeLeaves ./users/hm; }; @@ -140,15 +146,6 @@ homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; - - defaultTemplate = self.templates.bud; - templates.bud.path = ./.; - templates.bud.description = "bud template"; - } - // - { - budModules = { devos = import ./shell/bud; }; - } ; } diff --git a/hosts/PubSolarOS.nix b/hosts/PubSolarOS.nix index 3b084119..70cf7a08 100644 --- a/hosts/PubSolarOS.nix +++ b/hosts/PubSolarOS.nix @@ -1,7 +1,10 @@ { suites, ... }: { ### root password is empty by default ### - imports = suites.base; + ### default password: pub-solar, optional: add your SSH keys + imports = + suites.iso + ; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/hosts/bootstrap.nix b/hosts/bootstrap.nix index d491855d..c6d8f105 100644 --- a/hosts/bootstrap.nix +++ b/hosts/bootstrap.nix @@ -8,7 +8,10 @@ # profiles.networking profiles.core profiles.users.root # make sure to configure ssh keys - profiles.users.nixos + profiles.users.pub-solar + profiles.base-user + profiles.graphical + profiles.pub-solar-iso ]; boot.loader.systemd-boot.enable = true; diff --git a/lib/compat/nixos/default.nix b/lib/compat/nixos/default.nix index e4e0e68a..83f05f9f 100644 --- a/lib/compat/nixos/default.nix +++ b/lib/compat/nixos/default.nix @@ -2,7 +2,7 @@ let inherit (default.inputs.nixos) lib; - host = configs.${hostname} or configs.NixOS; + host = configs.${hostname} or configs.PubSolarOS; configs = default.nixosConfigurations; default = (import ../.).defaultNix; hostname = lib.fileContents /etc/hostname; diff --git a/modules/audio/default.nix b/modules/audio/default.nix index 51ec0b7e..fcceefd3 100644 --- a/modules/audio/default.nix +++ b/modules/audio/default.nix @@ -8,6 +8,8 @@ in { options.pub-solar.audio = { enable = mkEnableOption "Life in highs and lows"; + mopidy.enable = mkEnableOption "Life with mopidy"; + bluetooth.enable = mkEnableOption "Life with bluetooth"; }; config = mkIf cfg.enable { @@ -43,7 +45,7 @@ in config.pipewire-pulse = builtins.fromJSON (builtins.readFile ./pipewire-pulse.conf.json); # Bluetooth configuration for pipewire - media-session.config.bluez-monitor.rules = [ + media-session.config.bluez-monitor.rules = mkIf cfg.bluetooth.enable [ { # Matches all cards matches = [{ "device.name" = "~bluez_card.*"; }]; @@ -70,10 +72,10 @@ in }; # Enable bluetooth - hardware.bluetooth.enable = true; - services.blueman.enable = true; + hardware.bluetooth.enable = mkIf cfg.bluetooth.enable true; + services.blueman.enable = mkIf cfg.bluetooth.enable true; # Enable audio server & client - services.mopidy = import ./mopidy.nix pkgs; + services.mopidy = mkIf cfg.mopidy.enable ((import ./mopidy.nix) pkgs); }; } diff --git a/modules/crypto/default.nix b/modules/crypto/default.nix index 8e9c5ee9..712787aa 100644 --- a/modules/crypto/default.nix +++ b/modules/crypto/default.nix @@ -30,7 +30,7 @@ in }; home.packages = [ - gnome3.seahorse + gnome.seahorse keepassxc libsecret qMasterPassword diff --git a/modules/devops/default.nix b/modules/devops/default.nix index 04f886a0..9c0d9a9e 100644 --- a/modules/devops/default.nix +++ b/modules/devops/default.nix @@ -15,7 +15,8 @@ in drone-cli nmap pgcli - python38Packages.ansible + ansible + ansible-lint restic shellcheck terraform_0_15 diff --git a/modules/graphical/alacritty.nix b/modules/graphical/alacritty.nix index f08be710..e4e2f6ad 100644 --- a/modules/graphical/alacritty.nix +++ b/modules/graphical/alacritty.nix @@ -106,6 +106,23 @@ cursor = "0xe3e1e4"; }; + # Colors used for the search bar and match highlighting. + search = { + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + matches = { + foreground = "0xe5c463"; + background = "0x1a181a"; + }; + focused_match = { + foreground = "0xe5c463"; + background = "0xe3e1e4"; + }; + #bar = + # background = "#c5c8c6"; + # foreground = "#1d1f21"; + }; + # Normal colors normal = { black = "0x1a181a"; diff --git a/modules/graphical/default.nix b/modules/graphical/default.nix index bbf8f59d..d38b4d1a 100644 --- a/modules/graphical/default.nix +++ b/modules/graphical/default.nix @@ -26,6 +26,11 @@ in default = { }; }; }; + wayland.software-renderer.enable = mkOption { + type = types.bool; + default = false; + description = "Feature flag enabling wlroots software renderer, useful in VMs"; + }; }; config = mkIf cfg.enable { @@ -49,7 +54,7 @@ in }; }; - services.getty.autologinUser = "${psCfg.user.name}"; + services.getty.autologinUser = mkForce "${psCfg.user.name}"; qt5 = { enable = true; @@ -81,17 +86,20 @@ in source-sans-pro ]; - home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] { + home-manager = with pkgs; setAttrByPath [ "users" psCfg.user.name ] { home.packages = [ alacritty + foot chromium firefox-wayland flameshot libnotify - gnome3.adwaita-icon-theme + gnome.adwaita-icon-theme gnome.eog - gnome3.nautilus + gnome.nautilus + gnome.yelp + hicolor-icon-theme wine @@ -112,7 +120,7 @@ in enable = true; font.name = "Lato"; iconTheme = { - package = pkgs.papirus-maia-icon-theme; + package = pkgs.papirus-icon-theme; name = "Papirus-Adapta-Nokto-Maia"; }; theme = { diff --git a/modules/office/default.nix b/modules/office/default.nix index 74a21d7a..204e3ae8 100644 --- a/modules/office/default.nix +++ b/modules/office/default.nix @@ -17,9 +17,11 @@ in home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] { home.packages = [ libreoffice-fresh - gnome3.simple-scan + gnome.simple-scan # Tools like pdfunite poppler_utils + # tool for annotating PDFs + xournalpp ]; }; }; diff --git a/modules/server/default.nix b/modules/server/default.nix deleted file mode 100644 index 3821421c..00000000 --- a/modules/server/default.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ lib, config, pkgs, ... }: -with lib; -let - psCfg = config.pub-solar; - cfg = config.pub-solar.server; -in -{ - options.pub-solar.server = { - enable = mkEnableOption "Enable server options like sshd"; - }; - - config = mkIf cfg.enable { - services.openssh = { - enable = true; - permitRootLogin = "no"; - passwordAuthentication = false; - }; - }; -} diff --git a/modules/social/default.nix b/modules/social/default.nix index 90a23c3e..9c53718d 100644 --- a/modules/social/default.nix +++ b/modules/social/default.nix @@ -12,10 +12,9 @@ in config = mkIf cfg.enable { home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] { home.packages = [ - #mySignalDesktop - signal-desktop + ps-signal-desktop tdesktop - element-desktop-wayland + element-desktop irssi ]; }; diff --git a/modules/sway/config/config b/modules/sway/config/config deleted file mode 100644 index 752a96c5..00000000 --- a/modules/sway/config/config +++ /dev/null @@ -1,212 +0,0 @@ -# Default config for sway -# -# Copy this to ~/.config/sway/config and edit it to your liking. -# -# Read `man 5 sway` for a complete reference. - -### Variables -# -# Logo key. Use Mod1 for Alt. -set $mod Mod4 -# Home row direction keys, like vim -set $left j -set $down k -set $up i -set $right l -# Your preferred terminal emulator -set $term alacritty -# Your preferred application launcher -# Note: pass the final command to swaymsg so that the resulting window can be opened -# on the original workspace that the command was run on. -#set $menu dmenu_path | dmenu | xargs swaymsg exec bemenu-run --no-overlap - -default_border pixel 1 - -### Output configuration -# -# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) -output * bg ~/.config/wallpaper.jpg fill - -### Key bindings -# -# Basics: -# - # Start a terminal - bindsym $mod+Return exec $term - - # Start a terminal - bindsym $mod+Shift+Return exec sh -c '$term --working-directory $(wcwd)' - - # Kill focused window - bindsym $mod+Shift+q kill - - # Drag floating windows by holding down $mod and left mouse button. - # Resize them with right mouse button + $mod. - # Despite the name, also works for non-floating windows. - # Change normal to inverse to use left mouse button for resizing and right - # mouse button for dragging. - floating_modifier $mod normal - - # Reload the configuration file - bindsym $mod+Ctrl+r reload - -# -# Moving around: -# - # Move your focus around - bindsym $mod+$left focus left - bindsym $mod+$down focus down - bindsym $mod+$up focus up - bindsym $mod+$right focus right - # Or use $mod+[up|down|left|right] - bindsym $mod+Left focus left - bindsym $mod+Down focus down - bindsym $mod+Up focus up - bindsym $mod+Right focus right - - # Move the focused window with the same, but add Shift - bindsym $mod+Shift+$left move left - bindsym $mod+Shift+$down move down - bindsym $mod+Shift+$up move up - bindsym $mod+Shift+$right move right - # Ditto, with arrow keys - bindsym $mod+Shift+Left move left - bindsym $mod+Shift+Down move down - bindsym $mod+Shift+Up move up - bindsym $mod+Shift+Right move right -# -# Workspaces: -# - - - # Workspace names - # to display names or symbols instead of plain workspace numbers you can use - # something like: set $ws1 1:mail - # set $ws2 2: - set $ws1 1 - set $ws2 2 - set $ws3 3 - set $ws4 4 - set $ws5 5 - set $ws6 6 - set $ws7 7 - set $ws8 8 - set $ws9 9 - - # Switch to workspace - bindsym $mod+1 workspace 1 - bindsym $mod+2 workspace 2 - bindsym $mod+3 workspace 3 - bindsym $mod+4 workspace 4 - bindsym $mod+5 workspace 5 - bindsym $mod+6 workspace 6 - bindsym $mod+7 workspace 7 - bindsym $mod+8 workspace 8 - bindsym $mod+9 workspace 9 - # Move focused container to workspace - bindsym $mod+Ctrl+1 move container to workspace $ws1 - bindsym $mod+Ctrl+2 move container to workspace $ws2 - bindsym $mod+Ctrl+3 move container to workspace $ws3 - bindsym $mod+Ctrl+4 move container to workspace $ws4 - bindsym $mod+Ctrl+5 move container to workspace $ws5 - bindsym $mod+Ctrl+6 move container to workspace $ws6 - bindsym $mod+Ctrl+7 move container to workspace $ws7 - bindsym $mod+Ctrl+8 move container to workspace $ws8 - bindsym $mod+Ctrl+9 move container to workspace $ws9 - # Move focused container to workspace and move focus with it - bindsym $mod+Shift+1 move container to workspace 1; workspace $ws1 - bindsym $mod+Shift+2 move container to workspace 2; workspace $ws2 - bindsym $mod+Shift+3 move container to workspace 3; workspace $ws3 - bindsym $mod+Shift+4 move container to workspace 4; workspace $ws4 - bindsym $mod+Shift+5 move container to workspace 5; workspace $ws5 - bindsym $mod+Shift+6 move container to workspace 6; workspace $ws6 - bindsym $mod+Shift+7 move container to workspace 7; workspace $ws7 - bindsym $mod+Shift+8 move container to workspace 8; workspace $ws8 - bindsym $mod+Shift+9 move container to workspace 9; workspace $ws9 - # Note: workspaces can have any name you want, not just numbers. - # We just use 1-10 as the default. - - #navigate workspaces next / previous - bindsym $mod+Ctrl+Right workspace next - bindsym $mod+Ctrl+Left workspace prev - - # workspace back and forth (with/without active container) - workspace_auto_back_and_forth yes - bindsym $mod+b workspace back_and_forth - bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth - -# -# Layout stuff: -# - # Configure border style - default_border pixel 1 - default_floating_border normal - - # Hide borders - hide_edge_borders none - - # Font for window titles. Will also be used by the bar unless a different font - # is used in the bar {} block below. - font xft:Hack 16 - - # You can "split" the current object of your focus with - # $mod+b or $mod+v, for horizontal and vertical splits - # respectively. - bindsym $mod+h splith; exec notify-send 'tile horizontally' - bindsym $mod+v splitv; exec notify-send 'tile vertically' - - # Switch the current container between different layout styles - bindsym $mod+s layout stacking - bindsym $mod+w layout tabbed - bindsym $mod+e layout toggle split - - # Make the current focus fullscreen - bindsym $mod+f fullscreen - - # Toggle the current focus between tiling and floating mode - bindsym $mod+Shift+space floating toggle - - # Swap focus between the tiling area and the floating area - bindsym $mod+t focus mode_toggle - - # Move focus to the parent container - bindsym $mod+a focus parent - bindsym $mod+d focus child -# -# Scratchpad: -# - # Sway has a "scratchpad", which is a bag of holding for windows. - # You can send windows there and get them back later. - - # Move the currently focused window to the scratchpad - bindsym $mod+Shift+minus move scratchpad - - # Show the next scratchpad window or hide the focused scratchpad window. - # If there are multiple scratchpad windows, this command cycles through them. - bindsym $mod+minus scratchpad show -# -# Resizing containers: -# -mode "resize" { - # left will shrink the containers width - # right will grow the containers width - # up will shrink the containers height - # down will grow the containers height - bindsym $left resize shrink width 10px - bindsym $down resize grow height 10px - bindsym $up resize shrink height 10px - bindsym $right resize grow width 10px - - # Ditto, with arrow keys - bindsym Left resize shrink width 10px - bindsym Down resize grow height 10px - bindsym Up resize shrink height 10px - bindsym Right resize grow width 10px - - # Return to default mode - bindsym Return mode "default" - bindsym Escape mode "default" -} -bindsym $mod+r mode "resize" - -include ~/.config/sway/config.d/* diff --git a/modules/sway/config/config.d/custom-keybindings.conf b/modules/sway/config/config.d/custom-keybindings.conf index 46fae96d..157ae8ee 100644 --- a/modules/sway/config/config.d/custom-keybindings.conf +++ b/modules/sway/config/config.d/custom-keybindings.conf @@ -18,7 +18,7 @@ bindsym $mod+F2 exec firefox bindsym $mod+F3 exec $term -e vifm bindsym $mod+Shift+F3 exec gksu $term -e vifm bindsym $mod+F4 exec nautilus -w -bindsym $mod+Shift+F4 exec signal-desktop --enable-features=UseOzonePlatform --ozone-platform=wayland +bindsym $mod+Shift+F4 exec signal-desktop bindsym $mod+F5 exec $term -e 'mocp -C $XDG_CONFIG_DIR/mocp/config' bindsym $mod+Shift+m exec mu bindsym $mod+Shift+h exec xdg-open /usr/share/doc/manjaro/i3_help.pdf diff --git a/modules/sway/config/config.nix b/modules/sway/config/config.nix new file mode 100644 index 00000000..8e21ec02 --- /dev/null +++ b/modules/sway/config/config.nix @@ -0,0 +1,214 @@ +{ config, pkgs, ... }: +'' + # Default config for sway + # + # Copy this to ~/.config/sway/config and edit it to your liking. + # + # Read `man 5 sway` for a complete reference. + + ### Variables + # + # Logo key. Use Mod1 for Alt. + set $mod Mod4 + # Home row direction keys, like vim + set $left j + set $down k + set $up i + set $right l + # Your preferred terminal emulator + set $term ${config.pub-solar.sway.terminal} + # Your preferred application launcher + # Note: pass the final command to swaymsg so that the resulting window can be opened + # on the original workspace that the command was run on. + #set $menu dmenu_path | dmenu | xargs swaymsg exec bemenu-run --no-overlap + + default_border pixel 1 + + ### Output configuration + # + # Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) + output * bg ~/.config/wallpaper.jpg fill + + ### Key bindings + # + # Basics: + # + # Start a terminal + bindsym $mod+Return exec $term + + # Start a terminal + bindsym $mod+Shift+Return exec sh -c '$term --working-directory $(wcwd)' + + # Kill focused window + bindsym $mod+Shift+q kill + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Ctrl+r reload + + # + # Moving around: + # + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right + # + # Workspaces: + # + + + # Workspace names + # to display names or symbols instead of plain workspace numbers you can use + # something like: set $ws1 1:mail + # set $ws2 2: + set $ws1 1 + set $ws2 2 + set $ws3 3 + set $ws4 4 + set $ws5 5 + set $ws6 6 + set $ws7 7 + set $ws8 8 + set $ws9 9 + + # Switch to workspace + bindsym $mod+1 workspace 1 + bindsym $mod+2 workspace 2 + bindsym $mod+3 workspace 3 + bindsym $mod+4 workspace 4 + bindsym $mod+5 workspace 5 + bindsym $mod+6 workspace 6 + bindsym $mod+7 workspace 7 + bindsym $mod+8 workspace 8 + bindsym $mod+9 workspace 9 + # Move focused container to workspace + bindsym $mod+Ctrl+1 move container to workspace $ws1 + bindsym $mod+Ctrl+2 move container to workspace $ws2 + bindsym $mod+Ctrl+3 move container to workspace $ws3 + bindsym $mod+Ctrl+4 move container to workspace $ws4 + bindsym $mod+Ctrl+5 move container to workspace $ws5 + bindsym $mod+Ctrl+6 move container to workspace $ws6 + bindsym $mod+Ctrl+7 move container to workspace $ws7 + bindsym $mod+Ctrl+8 move container to workspace $ws8 + bindsym $mod+Ctrl+9 move container to workspace $ws9 + # Move focused container to workspace and move focus with it + bindsym $mod+Shift+1 move container to workspace 1; workspace $ws1 + bindsym $mod+Shift+2 move container to workspace 2; workspace $ws2 + bindsym $mod+Shift+3 move container to workspace 3; workspace $ws3 + bindsym $mod+Shift+4 move container to workspace 4; workspace $ws4 + bindsym $mod+Shift+5 move container to workspace 5; workspace $ws5 + bindsym $mod+Shift+6 move container to workspace 6; workspace $ws6 + bindsym $mod+Shift+7 move container to workspace 7; workspace $ws7 + bindsym $mod+Shift+8 move container to workspace 8; workspace $ws8 + bindsym $mod+Shift+9 move container to workspace 9; workspace $ws9 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. + + #navigate workspaces next / previous + bindsym $mod+Ctrl+Right workspace next + bindsym $mod+Ctrl+Left workspace prev + + # workspace back and forth (with/without active container) + workspace_auto_back_and_forth yes + bindsym $mod+b workspace back_and_forth + bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth + + # + # Layout stuff: + # + # Configure border style + default_border pixel 1 + default_floating_border normal + + # Hide borders + hide_edge_borders none + + # Font for window titles. Will also be used by the bar unless a different font + # is used in the bar {} block below. + font xft:Hack 16 + + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+h splith; exec notify-send 'tile horizontally' + bindsym $mod+v splitv; exec notify-send 'tile vertically' + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+t focus mode_toggle + + # Move focus to the parent container + bindsym $mod+a focus parent + bindsym $mod+d focus child + # + # Scratchpad: + # + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + bindsym $mod+Shift+minus move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + bindsym $mod+minus scratchpad show + # + # Resizing containers: + # + mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" + } + bindsym $mod+r mode "resize" + + include ~/.config/sway/config.d/*'' diff --git a/modules/sway/default.nix b/modules/sway/default.nix index cfc5733c..83f407e4 100644 --- a/modules/sway/default.nix +++ b/modules/sway/default.nix @@ -8,6 +8,11 @@ in options.pub-solar.sway = { enable = mkEnableOption "Life in boxes"; }; + options.pub-solar.sway.terminal = mkOption { + type = types.nullOr types.str; + default = "alacritty"; + description = "Choose sway's default terminal"; + }; options.pub-solar.sway.v4l2loopback.enable = mkOption { type = types.bool; default = true; @@ -32,7 +37,17 @@ in xdg.portal = { enable = true; - extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-wlr ]; + wlr = { + enable = true; + settings = { + screencast = { + max_fps = 30; + chooser_type = "simple"; + chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or"; + }; + }; + }; + extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; gtkUsePortal = true; }; @@ -76,7 +91,7 @@ in systemd.user.services.waybar = import ./waybar.service.nix pkgs; systemd.user.targets.sway-session = import ./sway-session.target.nix pkgs; - xdg.configFile."sway/config".source = ./config/config; + xdg.configFile."sway/config".text = import ./config/config.nix { inherit config pkgs; }; xdg.configFile."sway/config.d/colorscheme.conf".source = ./config/config.d/colorscheme.conf; 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; diff --git a/modules/terminal-life/default.nix b/modules/terminal-life/default.nix index 17262f77..75ca2bd3 100644 --- a/modules/terminal-life/default.nix +++ b/modules/terminal-life/default.nix @@ -26,6 +26,7 @@ in home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] { home.packages = [ ack + asciinema ag bat exa diff --git a/modules/terminal-life/nvim/default.nix b/modules/terminal-life/nvim/default.nix index e46c82e2..13b5fb3d 100644 --- a/modules/terminal-life/nvim/default.nix +++ b/modules/terminal-life/nvim/default.nix @@ -15,33 +15,16 @@ let }; }; - sonokai = pkgs.vimUtils.buildVimPlugin { - name = "sonokai"; - src = pkgs.fetchFromGitHub { - owner = "sainnhe"; - repo = "sonokai"; - rev = "51e7ee8b13f9c2e4eae33f8d745eaa1f320b0ae6"; - sha256 = "0svqr6dnpk2p5qhb6j0rllns8f0f4886wxpx69wgazjx84bx728i"; - }; - }; - suda = pkgs.vimUtils.buildVimPlugin { - name = "suda"; - src = pkgs.fetchFromGitHub { - owner = "lambdalisue"; - repo = "suda.vim"; - rev = "fbb138f5090c3db4dabeba15326397a09df6b73b"; - sha256 = "ztZ5UPd2y4Mkore/QLfMCwjM0Qy4eWCOw535NzDSfgY="; - }; - }; workspace = pkgs.vimUtils.buildVimPlugin { name = "vim-workspace"; src = pkgs.fetchFromGitHub { owner = "thaerkh"; repo = "vim-workspace"; - rev = "faa835406990171bbbeff9254303dad49bad17cb"; - sha256 = "w6CcFcIplwUVcvx54rbTwThBxus1k7yHot2TpdNQ61M="; + rev = "c26b473f9b073f24bacecd38477f44c5cd1f5a62"; + sha256 = "sha256-XV7opLyfkHIDO0+JJaO/x0za0gsHuklrzapTGdLHJmI="; }; }; + beautify = pkgs.vimUtils.buildVimPlugin { name = "vim-beautify"; src = pkgs.fetchFromGitHub { @@ -51,6 +34,16 @@ let sha256 = "QPTCl6KaGcAjTS5yVDov9yxmv0fDaFoPLMsrtVIG6GQ="; }; }; + + apprentice = pkgs.vimUtils.buildVimPlugin { + name = "vim-apprentice"; + src = pkgs.fetchFromGitHub { + owner = "romainl"; + repo = "Apprentice"; + rev = "ecd41698037f15a58125b349be76dbd2595bfb6d"; + sha256 = "sha256-9s7Yzn3IEJBjcyUq9NBIQ9wb45Xr7jOkEIoWf0lAYYg="; + }; + }; in { enable = true; @@ -74,9 +67,7 @@ in nodePackages.typescript-language-server nodePackages.vim-language-server nodePackages.vue-language-server - nodePackages.vscode-css-languageserver-bin - nodePackages.vscode-html-languageserver-bin - nodePackages.vscode-json-languageserver-bin + nodePackages.vscode-langservers-extracted nodePackages.yaml-language-server python39Packages.python-lsp-server python3Full @@ -99,16 +90,20 @@ in instant-nvim ack-vim - airline + vim-airline editorconfig-vim nnn-vim - suda + quick-scope + suda-vim syntastic vim-gutentags vim-vinegar workspace sonokai + vim-hybrid-material + vim-airline-themes + apprentice fugitive vim-gitgutter @@ -131,6 +126,7 @@ in vim-go vim-javascript vim-json + SchemaStore-nvim vim-markdown vim-nix vim-ruby diff --git a/modules/terminal-life/nvim/lsp.vim b/modules/terminal-life/nvim/lsp.vim index 1d5bf4d4..025d2b5f 100644 --- a/modules/terminal-life/nvim/lsp.vim +++ b/modules/terminal-life/nvim/lsp.vim @@ -8,43 +8,67 @@ set completeopt=menuone,noinsert,noselect " Avoid showing extra messages when using completion set shortmess+=c -" Configure neovim 5 experimental LSPs +function AddTemplate(tmpl_file) + exe "0read " . a:tmpl_file + set nomodified + 6 +endfunction + +autocmd BufNewFile shell.nix call AddTemplate("$XDG_DATA_HOME/nvim/templates/shell.nix.tmpl") + +" Configure neovim 0.6+ experimental LSPs " https://github.com/neovim/nvim-lspconfig -" https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md +" https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md +" https://github.com/neovim/nvim-lspconfig/wiki/UI-Customization " https://gitlab.com/Iron_E/dotfiles/-/blob/master/.config/nvim/lua/_config/plugin/nvim_lsp.lua lua <e', 'lua vim.diagnostic.open_float()', opts) + vim.api.nvim_set_keymap('n', 'g[', 'lua vim.diagnostic.goto_prev()', opts) + vim.api.nvim_set_keymap('n', 'g]', 'lua vim.diagnostic.goto_next()', opts) + vim.api.nvim_set_keymap('n', 'dq', 'lua vim.diagnostic.setloclist()', opts) + vim.api.nvim_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) + -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) - local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end - -- Enable completion triggered by - buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - local opts = { noremap=true, silent=true } + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + -- Mappings (available if LSP is configured and attached to buffer) -- See `:help vim.lsp.*` for documentation on any of the below functions - buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) - buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) - buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) - buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) - buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) - buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) - buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) - buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) + + -- Show diagnostic popup on cursor hold + vim.api.nvim_create_autocmd("CursorHold", { + buffer = bufnr, + callback = function() + local opts = { + focusable = false, + close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" }, + border = 'rounded', + source = 'always', + prefix = ' ', + scope = 'cursor', + } + vim.diagnostic.open_float(nil, opts) + end + }) end @@ -52,6 +76,9 @@ lua < g[ PrevDiagnosticCycle -" nnoremap g] NextDiagnosticCycle - " have a fixed column for the diagnostics to appear in " this removes the jitter when warnings/errors flow in -set signcolumn=yes +set signcolumn=yes:2 diff --git a/modules/terminal-life/nvim/plugins.vim b/modules/terminal-life/nvim/plugins.vim index 2086bfd7..87fe1841 100644 --- a/modules/terminal-life/nvim/plugins.vim +++ b/modules/terminal-life/nvim/plugins.vim @@ -4,9 +4,15 @@ autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab let g:gutentags_file_list_command = 'git ls-files' +" quick-scope +" https://github.com/unblevable/quick-scope +let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] + " Golang -" Go test shortcut +" Go test, Def, Decls shortcut nmap got :GoTest:botright copen +autocmd FileType go nmap gd :GoDef +autocmd FileType go nmap gD :GoDecls " Go formatting autocmd FileType go setlocal noexpandtab shiftwidth=4 tabstop=4 softtabstop=4 nolist diff --git a/modules/terminal-life/nvim/ui.vim b/modules/terminal-life/nvim/ui.vim index 0071792f..3131188f 100644 --- a/modules/terminal-life/nvim/ui.vim +++ b/modules/terminal-life/nvim/ui.vim @@ -14,3 +14,19 @@ let g:airline#extensions#tabline#formatter = 'unique_tail_improved' let g:airline_powerline_fonts = 1 " Use powerline fonts let g:airline_theme = 'sonokai' +" Customize fzf colors to match your color scheme +" - fzf#wrap translates this to a set of `--color` options +let g:fzf_colors = +\ { 'fg': ['fg', 'Normal'], + \ 'bg': ['bg', 'Normal'], + \ 'hl': ['fg', 'Comment'], + \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], + \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], + \ 'hl+': ['fg', 'Statement'], + \ 'info': ['fg', 'PreProc'], + \ 'border': ['fg', 'Ignore'], + \ 'prompt': ['fg', 'Conditional'], + \ 'pointer': ['fg', 'Exception'], + \ 'marker': ['fg', 'Keyword'], + \ 'spinner': ['fg', 'Label'], + \ 'header': ['fg', 'Comment'] } diff --git a/modules/terminal-life/zsh/default.nix b/modules/terminal-life/zsh/default.nix index d892170c..2541fdd0 100644 --- a/modules/terminal-life/zsh/default.nix +++ b/modules/terminal-life/zsh/default.nix @@ -22,7 +22,6 @@ in [ "$(tty)" = "/dev/tty1" ] && exec sway ''; - shellAliases = { nano = "nvim"; vi = "nvim"; @@ -38,6 +37,7 @@ in no = "manix \"\" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview=\"manix '{}'\" | xargs manix"; # fix nixos-option nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat"; + myip = "dig +short myip.opendns.com @208.67.222.222 2>&1"; }; zplug = { enable = true; @@ -71,18 +71,24 @@ in bindkey '^R' fzf-history-widget # ArrowUp/Down start searching history with current input - autoload -U history-search-end - zle -N history-beginning-search-backward-end history-search-end - zle -N history-beginning-search-forward-end history-search-end - bindkey "^[[A" history-beginning-search-backward-end - bindkey "^[[B" history-beginning-search-forward-end - bindkey "^P" history-beginning-search-backward-end - bindkey "^N" history-beginning-search-forward-end + autoload -U up-line-or-beginning-search + autoload -U down-line-or-beginning-search + zle -N up-line-or-beginning-search + zle -N down-line-or-beginning-search + bindkey "^[[A" up-line-or-beginning-search + bindkey "^[[B" down-line-or-beginning-search + bindkey "^P" up-line-or-beginning-search + bindkey "^N" down-line-or-beginning-search # MAKE CTRL+S WORK IN VIM stty -ixon stty erase '^?' + precmd () { + DIR_NAME=$(pwd | sed "s|^$HOME|~|g") + echo -e "\e]2;$DIR_NAME\e\\" + } + # If a command is not found, show me where it is source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh '' diff --git a/modules/terminal-life/zsh/p10k.zsh b/modules/terminal-life/zsh/p10k.zsh index be207b58..90734313 100644 --- a/modules/terminal-life/zsh/p10k.zsh +++ b/modules/terminal-life/zsh/p10k.zsh @@ -195,7 +195,16 @@ typeset -g POWERLEVEL9K_DIR_{HOME,HOME_SUBFOLDER}_BACKGROUND=1 typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_BACKGROUND=1 - typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true + # If directory is too long, shorten some of its segments to the shortest possible unique + # prefix. The shortened directory can be tab-completed to the original. + typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique + # Color of the shortened directory segments. + typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=0 + # Color of the anchor directory segments. Anchor segments are never shortened. The first + # segment is always an anchor. + typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=0 + # Display anchor directory segments in bold. + typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=false # Don't shorten directories that contain any of these files. They are anchors. local anchor_files=( .bzr @@ -228,13 +237,13 @@ # contains a marker (.git) and other directories don't. typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false # Don't shorten this many last directory segments. They are anchors. - typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=100 + typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 # Shorten directory if it's longer than this even if there is space for it. The value can # be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty, # directory will be shortened only when prompt doesn't fit or when other parameters demand it # (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below). # If set to `0`, directory will always be shortened to its minimum length. - typeset -g POWERLEVEL9K_DIR_MAX_LENGTH= + typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80 # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this # many columns for typing commands. typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40 diff --git a/modules/user/default.nix b/modules/user/default.nix index 79e32eca..2fd5958e 100644 --- a/modules/user/default.nix +++ b/modules/user/default.nix @@ -21,6 +21,11 @@ in type = types.nullOr types.str; default = null; }; + publicKeys = mkOption { + description = "User SSH public keys"; + type = types.listOf types.path; + default = [ ]; + }; fullName = mkOption { description = "User full name"; type = types.nullOr types.str; diff --git a/modules/virtualisation/default.nix b/modules/virtualisation/default.nix index 4d588622..edc402c3 100644 --- a/modules/virtualisation/default.nix +++ b/modules/virtualisation/default.nix @@ -14,12 +14,13 @@ in config = mkIf cfg.enable { boot.kernelParams = [ "amd_iommu=on" + "intel_iommu=on" "iommu=pt" ]; virtualisation.libvirtd = { enable = true; - qemuOvmf = true; + qemu.ovmf.enable = true; }; users.users = pkgs.lib.setAttrByPath [ psCfg.user.name ] { extraGroups = [ "libvirtd" ]; diff --git a/modules/x-os/boot.nix b/modules/x-os/boot.nix index 51cd5b4b..0633bec4 100644 --- a/modules/x-os/boot.nix +++ b/modules/x-os/boot.nix @@ -1,16 +1,22 @@ { config, pkgs, lib, ... }: - +with lib; let cfg = config.pub-solar.x-os; in { + options.pub-solar.x-os.iso-options.enable = mkOption { + type = types.bool; + default = false; + description = "Feature flag for iso builds"; + }; config = { # Enable plymouth for better experience of booting boot.plymouth.enable = true; # Mount / luks device in initrd # Allow fstrim to work on it. - boot.initrd = { + # The ! makes this enabled by default + boot.initrd = mkIf (!cfg.iso-options.enable) { luks.devices."cryptroot" = { allowDiscards = true; }; diff --git a/overlays/overrides.nix b/overlays/overrides.nix index cf036d8c..9b463e96 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -14,7 +14,7 @@ channels: final: prev: { starship deploy-rs - element-desktop-wayland + nixUnstable neovim-unwrapped tdesktop xdg-desktop-portal @@ -23,10 +23,10 @@ channels: final: prev: { obs-studio obs-studio-plugins looking-glass-client + nix-direnv + vimPlugins ; - # nix is set to 2.3 in 21.11 - nix-direnv = prev.nix-direnv.override { nix_2_4 = true; }; haskellPackages = prev.haskellPackages.override (old: { diff --git a/pkgs/default.nix b/pkgs/default.nix index d8a86fd7..ba2007dc 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -15,4 +15,7 @@ with final; { toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final); uhk-agent = import ./uhk-agent.nix final; wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final); + + # ps-fixes + ps-signal-desktop = writeShellScriptBin "signal-desktop" (import ./ps-signal-desktop.nix final); } diff --git a/pkgs/lgcl.nix b/pkgs/lgcl.nix index 4ef2dac9..1d973e81 100644 --- a/pkgs/lgcl.nix +++ b/pkgs/lgcl.nix @@ -1,3 +1,9 @@ -self: with self; '' - ${self.looking-glass-client}/bin/looking-glass-client -f /dev/shm/looking-glass input:ignoreWindowsKeys=yes input:grabKeyboardOnFocus=no +self: with self; +let + looking-glass-client = self.looking-glass-client.overrideAttrs (old: { + meta.platforms = [ "x86_64-linux" "aarch64-linux" ]; + }); +in +'' + ${looking-glass-client}/bin/looking-glass-client -f /dev/shm/looking-glass input:ignoreWindowsKeys=yes input:grabKeyboardOnFocus=no '' diff --git a/pkgs/mopidy-jellyfin.nix b/pkgs/mopidy-jellyfin.nix index 8c99ac21..a3cde276 100644 --- a/pkgs/mopidy-jellyfin.nix +++ b/pkgs/mopidy-jellyfin.nix @@ -1,20 +1,20 @@ self: with self; let - websocket-client = python38.pkgs.buildPythonPackage rec { + websocket-client = python39.pkgs.buildPythonPackage rec { pname = "websocket-client"; - version = "1.0.0"; + version = "1.2.1"; doCheck = false; - src = python38.pkgs.fetchPypi { + src = python39.pkgs.fetchPypi { inherit pname version; - sha256 = "sha256-UFGzii9MJ/vXygd+uyPsaWWmJt7VqVY382vhs1tsT4E="; + sha256 = "sha256-jftxXYqZL1cS//jIQ62ulOIrIqmbLF5rDsShqYHMTg0="; }; }; in -python38.pkgs.buildPythonPackage rec { +python39.pkgs.buildPythonPackage rec { pname = "Mopidy-Jellyfin"; version = "1.0.2"; doCheck = false; - propagatedBuildInputs = with python38.pkgs; [ + propagatedBuildInputs = with python39.pkgs; [ unidecode websocket-client requests @@ -22,7 +22,7 @@ python38.pkgs.buildPythonPackage rec { pykka mopidy ]; - src = python38.pkgs.fetchPypi { + src = python39.pkgs.fetchPypi { inherit pname version; sha256 = "sha256-5XimIIQSpvNyQbSOFtSTkA0jhA0V68BbyQEQNnov+0g="; }; diff --git a/pkgs/ps-signal-desktop.nix b/pkgs/ps-signal-desktop.nix new file mode 100644 index 00000000..ff615639 --- /dev/null +++ b/pkgs/ps-signal-desktop.nix @@ -0,0 +1,9 @@ +self: with self; +let + signal-desktop = self.signal-desktop.overrideAttrs (old: { + meta.platforms = [ "x86_64-linux" "aarch64-linux" ]; + }); +in +'' + exec ${signal-desktop}/bin/signal-desktop --disable-gpu -- "$@" +'' diff --git a/profiles/audio/default.nix b/profiles/audio/default.nix new file mode 100644 index 00000000..22b64af5 --- /dev/null +++ b/profiles/audio/default.nix @@ -0,0 +1,6 @@ +{ self, config, lib, pkgs, ... }: +let inherit (lib) fileContents; +in +{ + pub-solar.audio.enable = true; +} diff --git a/profiles/base-user/.config/git/config.nix b/profiles/base-user/.config/git/config.nix index 53c53a77..2553ec66 100644 --- a/profiles/base-user/.config/git/config.nix +++ b/profiles/base-user/.config/git/config.nix @@ -24,6 +24,7 @@ in [commit] gpgsign = true + template = ${xdg.configHome}/git/gitmessage [tag] gpgsign = true [init] diff --git a/profiles/base-user/.config/git/gitmessage.nix b/profiles/base-user/.config/git/gitmessage.nix new file mode 100644 index 00000000..7f4b1c64 --- /dev/null +++ b/profiles/base-user/.config/git/gitmessage.nix @@ -0,0 +1,32 @@ +{ config, pkgs, ... }: +let + user = config.pub-solar.user; + xdg = config.home-manager.users."${user.name}".xdg; +in +'' +# Title: Summary, imperative, start upper case, don't end with a period +# No more than 50 chars. #### 50 chars is here: # +# + + +# ^ Remember ending with an extra blank line +# Body: Explain *what* and *why* (not *how*). Include issue number. +# Wrap at 72 chars. ################################## which is here: # +# + + +# ^ Remember ending with an extra blank line +# At the end: Include Co-authored-by for all contributors. +# +Co-authored-by: ${user.fullName} <${user.email}> + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# On branch master +# Your branch is up to date with 'origin/main'. +# +# Changes to be committed: +# new file: installation.md +# +'' diff --git a/profiles/base-user/.config/waybar/config b/profiles/base-user/.config/waybar/config index 3ac2f37a..77bb74b8 100644 --- a/profiles/base-user/.config/waybar/config +++ b/profiles/base-user/.config/waybar/config @@ -4,7 +4,7 @@ "height": 26, // Waybar height "modules-left": ["sway/workspaces", "sway/mode"], - "modules-center": ["mpd"], + //"modules-center": ["mpd"], "modules-right": ["sway/language", "pulseaudio", "network", "idle_inhibitor", "battery", "clock", "tray"], "sway/workspaces": { "disable-scroll": true diff --git a/profiles/base-user/default.nix b/profiles/base-user/default.nix index 80ac262e..8f304794 100644 --- a/profiles/base-user/default.nix +++ b/profiles/base-user/default.nix @@ -19,6 +19,7 @@ in extraGroups = [ "wheel" "docker" "input" "audio" "networkmanager" "lp" "scanner" ]; initialHashedPassword = if psCfg.user.password != null then psCfg.user.password else ""; shell = pkgs.zsh; + openssh.authorizedKeys.keyFiles = if psCfg.user.publicKeys != null then psCfg.user.publicKeys else [ ]; }; }; } diff --git a/profiles/base-user/home.nix b/profiles/base-user/home.nix index 4becfab3..1ae6bd36 100644 --- a/profiles/base-user/home.nix +++ b/profiles/base-user/home.nix @@ -20,7 +20,7 @@ in home.packages = with pkgs; [ ]; - fonts.fontconfig.enable = true; + fonts.fontconfig.enable = mkForce true; programs.dircolors.enable = true; programs.dircolors.enableZshIntegration = true; @@ -32,6 +32,7 @@ in xdg.mimeApps = import ./mimeapps.nix; xdg.configFile."git/config".text = import ./.config/git/config.nix { inherit config; inherit pkgs; }; + xdg.configFile."git/gitmessage".text = import ./.config/git/gitmessage.nix { inherit config; inherit pkgs; }; xdg.configFile."git/global_gitignore".text = import ./.config/git/global_gitignore.nix { inherit config; inherit pkgs; }; xdg.configFile."dircolors".source = ./.config/dircolors; xdg.configFile."xmodmap".source = ./.config/xmodmap; @@ -54,6 +55,20 @@ in # Ensure nvim backup directory gets created # Workaround for E510: Can't make backup file (add ! to override) xdg.dataFile."nvim/backup/.keep".text = ""; + xdg.dataFile."nvim/templates/.keep".text = ""; + xdg.dataFile."shell.nix.tmpl" = { + text = '' + let + unstable = import (fetchTarball https://github.com/nixos/nixpkgs/archive/nixos-unstable.tar.gz) { }; + in + { nixpkgs ? import {} }: + with nixpkgs; mkShell { + buildInputs = [ + ]; + } + ''; + target = "nvim/templates/shell.nix.tmpl"; + }; # Allow unfree packages only on a user basis, not on a system-wide basis xdg.configFile."nixpkgs/config.nix".text = " { allowUnfree = true; } "; diff --git a/profiles/base-user/session-variables.nix b/profiles/base-user/session-variables.nix index 264d787f..5bbfa8ee 100644 --- a/profiles/base-user/session-variables.nix +++ b/profiles/base-user/session-variables.nix @@ -1,6 +1,7 @@ { config, pkgs, ... }: let psCfg = config.pub-solar; + wlroots = psCfg.graphical.wayland; xdg = config.home-manager.users."${psCfg.user.name}".xdg; variables = { XDG_CONFIG_HOME = xdg.configHome; @@ -15,6 +16,7 @@ let ECORE_EVAS_ENGINE = "wayland_egl"; ELM_ENGINE = "wayland_egl"; SDL_VIDEODRIVER = "wayland"; + WLR_RENDERER = if wlroots.software-renderer.enable then "pixman" else "gles2"; EDITOR = "/etc/profiles/per-user/${psCfg.user.name}/bin/nvim"; VISUAL = "/etc/profiles/per-user/${psCfg.user.name}/bin/nvim"; @@ -58,6 +60,9 @@ let # experimental wayland in firefox/thunderbird MOZ_ENABLE_WAYLAND = "1"; + # chromium / electron on wayland: enable ozone (native wayland mode) + NIXOS_OZONE_WL = "1"; + # Vagrant VAGRANT_HOME = "${xdg.dataHome}/vagrant"; VAGRANT_DEFAULT_PROVIDER = "libvirt"; diff --git a/profiles/core/default.nix b/profiles/core/default.nix index 1e62186b..9348249b 100644 --- a/profiles/core/default.nix +++ b/profiles/core/default.nix @@ -1,7 +1,8 @@ -{ self, config, lib, pkgs, ... }: +{ self, config, lib, pkgs, inputs, ... }: let inherit (lib) fileContents; in { + # Sets nrdxp.cachix.org binary cache which just speeds up some builds imports = [ ../cachix ]; config = { @@ -9,13 +10,8 @@ in pub-solar.audio.enable = true; pub-solar.crypto.enable = true; pub-solar.devops.enable = true; - pub-solar.docker.enable = true; - pub-solar.nextcloud.enable = true; - pub-solar.office.enable = true; - # pub-solar.printing.enable = true; # this is enabled automatically if office is enabled - pub-solar.server.enable = true; - pub-solar.printing.enable = true; + # This is just a representation of the nix default nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; environment = { @@ -26,6 +22,7 @@ in progress dnsutils inetutils + mtr pciutils usbutils gitFull @@ -68,9 +65,11 @@ in manix nix-index nix-tree + nixpkgs-review # Build broken, python2.7-PyJWT-2.0.1.drv' failed #nixops psos + nvd # Fun neofetch @@ -90,20 +89,21 @@ in }; nix = { - package = pkgs.nix-dram; + # use nix-dram, a patched nix command, see: https://github.com/dramforever/nix-dram + package = inputs.nix-dram.packages.${pkgs.system}.nix-dram; + # Improve nix store disk usage autoOptimiseStore = true; - gc.automatic = true; - optimise.automatic = true; + # Prevents impurities in builds useSandbox = true; - allowedUsers = [ "@wheel" ]; - + # give root and @wheel special privileges with nix trustedUsers = [ "root" "@wheel" ]; + # Generally useful nix option defaults extraOptions = '' min-free = 536870912 keep-outputs = true @@ -114,17 +114,18 @@ in ''; }; - system.autoUpgrade.enable = true; - # For rage encryption, all hosts need a ssh key pair services.openssh = { enable = true; openFirewall = lib.mkDefault false; }; + # Service that makes Out of Memory Killer more effective services.earlyoom.enable = true; - boot.kernelPackages = pkgs.linuxPackages_latest; + # Use latest LTS linux kernel by default + boot.kernelPackages = pkgs.linuxPackages_5_15; + boot.supportedFilesystems = [ "ntfs" ]; }; } diff --git a/profiles/full-install/default.nix b/profiles/full-install/default.nix new file mode 100644 index 00000000..ba136554 --- /dev/null +++ b/profiles/full-install/default.nix @@ -0,0 +1,15 @@ +{ self, config, lib, pkgs, ... }: +let inherit (lib) fileContents; +in +{ + imports = [ ../cachix ]; + + config = { + pub-solar.audio.mopidy.enable = true; + pub-solar.audio.bluetooth.enable = true; + pub-solar.docker.enable = true; + pub-solar.nextcloud.enable = true; + pub-solar.office.enable = true; + # pub-solar.printing.enable = true; # this is enabled automatically if office is enabled + }; +} diff --git a/profiles/graphical/default.nix b/profiles/graphical/default.nix index 62acad2f..237a74e5 100644 --- a/profiles/graphical/default.nix +++ b/profiles/graphical/default.nix @@ -4,5 +4,4 @@ in { pub-solar.graphical.enable = true; pub-solar.sway.enable = true; - pub-solar.social.enable = true; } diff --git a/profiles/pub-solar-iso/default.nix b/profiles/pub-solar-iso/default.nix new file mode 100644 index 00000000..24b5e1b3 --- /dev/null +++ b/profiles/pub-solar-iso/default.nix @@ -0,0 +1,11 @@ +{ self, config, lib, pkgs, ... }: +let inherit (lib) fileContents; +in +{ + imports = [ ../cachix ]; + config = { + pub-solar.graphical.wayland.software-renderer.enable = true; + pub-solar.sway.terminal = "foot"; + pub-solar.x-os.iso-options.enable = true; + }; +} diff --git a/profiles/social/default.nix b/profiles/social/default.nix new file mode 100644 index 00000000..cad05d33 --- /dev/null +++ b/profiles/social/default.nix @@ -0,0 +1,6 @@ +{ self, config, lib, pkgs, ... }: +let inherit (lib) fileContents; +in +{ + pub-solar.social.enable = true; +} diff --git a/shell/bud/default.nix b/shell/bud/default.nix deleted file mode 100644 index c486636b..00000000 --- a/shell/bud/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, lib, budUtils, ... }: { - bud.cmds = with pkgs; { - get = { - writer = budUtils.writeBashWithPaths [ nixUnstable git coreutils ]; - synopsis = "get [DEST]"; - help = "Copy the desired template to DEST"; - script = ./get.bash; - }; - }; -} diff --git a/shell/bud/get.bash b/shell/bud/get.bash deleted file mode 100644 index 7c10d1ba..00000000 --- a/shell/bud/get.bash +++ /dev/null @@ -1 +0,0 @@ -git clone https://github.com/divnix/devos.git "${2:-devos}" diff --git a/shell/devos.nix b/shell/devos.nix index dd6f75ef..bb9f1744 100644 --- a/shell/devos.nix +++ b/shell/devos.nix @@ -15,6 +15,9 @@ in imports = [ "${extraModulesPath}/git/hooks.nix" ]; git = { inherit hooks; }; + # 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: @@ -45,10 +48,11 @@ in (docs mdbook) (devos inputs.deploy.packages.${pkgs.system}.deploy-rs) ] - ++ lib.optional (system != "i686-linux") (devos cachix) - + ++ lib.optional + (system != "aarch64-darwin") + (devos inputs.nixos-generators.defaultPackage.${pkgs.system}) ; } diff --git a/users/nixos/default.nix b/users/nixos/default.nix deleted file mode 100644 index 077a52e4..00000000 --- a/users/nixos/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ hmUsers, ... }: -{ - home-manager.users = { inherit (hmUsers) nixos; }; - - users.users.nixos = { - password = "nixos"; - description = "default"; - isNormalUser = true; - extraGroups = [ "wheel" ]; - }; -} diff --git a/users/pub-solar/default.nix b/users/pub-solar/default.nix new file mode 100644 index 00000000..e80b64dd --- /dev/null +++ b/users/pub-solar/default.nix @@ -0,0 +1,19 @@ +{ hmUsers, ... }: +{ + home-manager.users = { inherit (hmUsers) pub-solar; }; + + pub-solar = { + # These are your personal settings + # The only required settings are `name` and `password`, + # for convenience, use publicKeys to add your SSH keys + # The rest is used for programs like git + user = { + name = "pub-solar"; + # default password = pub-solar + password = "$6$Kv0BCLU2Jg7GN8Oa$hc2vERKCbZdczFqyHPfgCaleGP.JuOWyd.bfcIsLDNmExGXI6Rnkze.SWzVzVS311KBznN/P4uUYAUADXkVtr."; + fullName = "Pub Solar"; + email = "iso@pub.solar"; + publicKeys = [ ]; + }; + }; +}