diff --git a/.gitignore b/.gitignore index c50c560a..d0e363cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,12 @@ result -up -hosts/up-* .direnv doc/index.html -<<<<<<< HEAD -tags -======= # Result of flk commands vm iso doi ->>>>>>> devos/core + +pkgs/_sources/.shake* + +tags diff --git a/README.md b/README.md index b7cd8871..fc5bb769 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,18 @@ Also, have a look at [_flake.nix_][toc]. If anything is not immediately discoverable via "[`digga`][digga]'s [`mkFlake`][mk-flake], please file a bug report. -### Status: Beta -Although this project has already matured quite a bit, especially through -recent outfactoring of [`digga`][digga], a fair amount of api polishing is still -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 😜 +## Motivation +NixOS provides an amazing abstraction to manage our environment, but that new +power can sometimes bring feelings of overwhelm and confusion. Having a turing +complete system can easily lead to unlimited complexity if we do it wrong. +Instead, we should have a community consensus on how to manage a NixOS system +and its satellite projects, from which best practices can evolve. -## In the Wild -* The original [authors][please] +___The future is declarative! 🎉___ + +## Examples in the Wild +The author maintains his own branch, so you can take inspiration, direction, or +make critical comments about the [code][please]. 😜 ## Shoulders This work does not reinvent the wheel. It stands on the [shoulders of the @@ -43,6 +47,7 @@ following giants][giants]: ### :family: — like family - [`numtide/devshell`][devshell] - [`serokell/deploy-rs`][deploy] +- [`berberman/nvfetcher`][nvfetcher] - [`NixOS/nixpkgs`][nixpkgs] :heart: @@ -68,23 +73,23 @@ goals are sufficiently upstreamed into "the Nix", dissolved. # License DevOS is licensed under the [MIT License][mit]. -[mk-flake]: https://github.com/divnix/digga/tree/master/src/mkFlake -[nixpkgs]: https://github.com/NixOS/nixpkgs -[deploy]: https://github.com/serokell/deploy-rs -[toc]: https://github.com/divnix/devos/blob/core/flake.nix -[giants]: https://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants -[digga]: https://github.com/divnix/digga -[fup]: https://github.com/gytis-ivaskevicius/flake-utils-plus -[fu]: https://github.com/numtide/flake-utils -[devshell]: https://github.com/numtide/devshell -[nix]: https://nixos.org/manual/nix/stable -[mit]: https://mit-license.org -[nixos]: https://nixos.org/manual/nixos/stable -[home-manager]: https://nix-community.github.io/home-manager -[flakes]: https://nixos.wiki/wiki/Flakes -[flake-doc]: https://github.com/NixOS/nix/blob/master/src/nix/flake.md -[core]: https://github.com/divnix/devos [community]: https://github.com/divnix/devos/tree/community +[core]: https://github.com/divnix/devos +[deploy]: https://github.com/serokell/deploy-rs +[devshell]: https://github.com/numtide/devshell +[digga]: https://github.com/divnix/digga [dotfiles]: https://github.com/hlissner/dotfiles +[flake-doc]: https://github.com/NixOS/nix/blob/master/src/nix/flake.md +[flakes]: https://nixos.wiki/wiki/Flakes +[fu]: https://github.com/numtide/flake-utils +[fup]: https://github.com/gytis-ivaskevicius/flake-utils-plus +[giants]: https://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants +[home-manager]: https://nix-community.github.io/home-manager +[mit]: https://mit-license.org +[mk-flake]: https://github.com/divnix/digga/tree/master/src/mkFlake +[nix]: https://nixos.org/manual/nix/stable +[nixos]: https://nixos.org/manual/nixos/stable +[nixpkgs]: https://github.com/NixOS/nixpkgs +[nvfetcher]: https://github.com/berberman/nvfetcher [please]: https://github.com/nrdxp/devos/tree/nrd -[matrix]: https://matrix.to/#/#devos:nixos.org +[toc]: https://github.com/divnix/devos/blob/core/flake.nix diff --git a/doc/SUMMARY.md b/doc/SUMMARY.md index e2b6e9a4..4378683f 100644 --- a/doc/SUMMARY.md +++ b/doc/SUMMARY.md @@ -31,5 +31,6 @@ - [Integrations](./integrations/index.md) - [Cachix](./integrations/cachix.md) - [Deploy RS](./integrations/deploy.md) + - [NvFetcher](./integrations/nvfetcher.md) - [Hercules CI](./integrations/hercules.md) - [Contributing](./CONTRIBUTING.md) diff --git a/doc/integrations/nvfetcher.md b/doc/integrations/nvfetcher.md new file mode 100644 index 00000000..2bfaa029 --- /dev/null +++ b/doc/integrations/nvfetcher.md @@ -0,0 +1,43 @@ +# nvfetcher +[NvFetcher][nvf] is a workflow companion for updating nix sources. + +You can specify an origin source and an update configuration, and +nvfetcher can for example track updates to a specific branch and +automatically update your nix sources configuration on each run +to the tip of that branch. + +All package source declaration is done in [sources.toml][sources.toml]. + +From within the devshell of this repo, run `nvfetcher`, a wrapped +version of `nvfetcher` that knows where to find and place its files +and commit the results. + +## Usage + +Statically fetching (not tracking) a particular tag from a github repo: +```toml +[manix] +src.manual = "v0.6.3" +fetch.github = "mlvzk/manix" +``` + +Tracking the latest github _release_ from a github repo: +```toml +[manix] +src.github = "mlvzk/manix" # responsible for tracking +fetch.github = "mlvzk/manix" # responsible for fetching +``` + +Tracking the latest commit of a git repository and fetch from a git repo: +```toml +[manix] +src.git = "https://github.com/mlvzk/manix.git" # responsible for tracking +fetch.git = "https://github.com/mlvzk/manix.git" # responsible for fetching +``` + +> ##### _Note:_ +> Please refer to the [NvFetcher Readme][nvf-readme] for more options. + +[nvf: https://github.com/berberman/nvfetcher +[nvf-readme]: https://github.com/berberman/nvfetcher#readme +[sources.toml]: https://github.com/divnix/devos/tree/core/pkgs/sources.toml diff --git a/flake.lock b/flake.lock index 049545d4..868ba07e 100644 --- a/flake.lock +++ b/flake.lock @@ -20,9 +20,52 @@ "type": "github" } }, + "blank": { + "locked": { + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, + "bud": { + "inputs": { + "devshell": [ + "digga", + "devshell" + ], + "nixpkgs": [ + "nixos" + ] + }, + "locked": { + "lastModified": 1626456025, + "narHash": "sha256-TrKfxVir+TilnqSNYokxJKx2ugEem7Khv4YmSwqj9JQ=", + "owner": "divnix", + "repo": "bud", + "rev": "59c10c3879b11371944ab664462fe2e9366cfb44", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "bud", + "type": "github" + } + }, "ci-agent": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": [ + "digga", + "deploy", + "flake-compat" + ], "nix-darwin": [ "darwin" ], @@ -70,17 +113,21 @@ }, "deploy": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat", "naersk": "naersk", - "nixpkgs": "nixpkgs", - "utils": "utils" + "nixpkgs": [ + "nixpkgs" + ], + "utils": [ + "flake-utils" + ] }, "locked": { - "lastModified": 1616406726, - "narHash": "sha256-n9zmgxR03QNrvs9/fHewqE0j3SjL7Y+cglBCFu3U3rg=", + "lastModified": 1625729093, + "narHash": "sha256-hpo8T7mlVEpHpZIYqhxqt5i/XY8eu4p66MrAg/MCuVY=", "owner": "serokell", "repo": "deploy-rs", - "rev": "9e405fbc5ab5bacbd271fd78c6b6b6877c4d9f8d", + "rev": "587cbcfe8d3ea05c5bb153764d3617012ef28c86", "type": "github" }, "original": { @@ -91,11 +138,11 @@ }, "devshell": { "locked": { - "lastModified": 1622013274, - "narHash": "sha256-mK/Lv0lCbl07dI5s7tR/7nb79HunKnJik3KyR6yeI2k=", + "lastModified": 1625086391, + "narHash": "sha256-IpNPv1v8s4L3CoxhwcgZIitGpcrnNgnj09X7TA0QV3k=", "owner": "numtide", "repo": "devshell", - "rev": "e7faf69e6bf8546517cc936c7f6d31c7eb3abcb2", + "rev": "4b5ac7cf7d9a1cc60b965bb51b59922f2210cbc7", "type": "github" }, "original": { @@ -106,23 +153,33 @@ }, "digga": { "inputs": { + "blank": "blank", "deploy": "deploy", "devshell": "devshell", - "nixlib": "nixlib", - "nixpkgs": "nixpkgs_2", - "utils": "utils_2" + "flake-utils": "flake-utils", + "home-manager": [ + "home" + ], + "nixlib": [ + "nixos" + ], + "nixos-generators": "nixos-generators", + "nixpkgs": [ + "nixos" + ], + "utils": "utils" }, "locked": { - "lastModified": 1623197477, - "narHash": "sha256-2Qk/uIHb1nXre2rRlGonAJmpuamBs7RRfgXhMmS5JkU=", + "lastModified": 1626470112, + "narHash": "sha256-hC5I3A1HxfGi45avpYBf8zXi1hQkHYWgRgUM4sF9byI=", "owner": "divnix", "repo": "digga", - "rev": "f69703abc33f221b676966a8435c4f09ef70ff49", + "rev": "f25928ed0bf05ab20af5a8231d264ae01b42ab34", "type": "github" }, "original": { "owner": "divnix", - "ref": "master", + "ref": "develop", "repo": "digga", "type": "github" } @@ -143,29 +200,13 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1606424373, - "narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { "locked": { - "lastModified": 1620759905, - "narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=", + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", "owner": "numtide", "repo": "flake-utils", - "rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", "type": "github" }, "original": { @@ -196,26 +237,27 @@ ] }, "locked": { - "lastModified": 1626073055, - "narHash": "sha256-vocByfpVu6m9zvtJugDvmd6/9iT2HJuG4tmDICKd0lI=", + "lastModified": 1624228557, + "narHash": "sha256-wwOqe73BsrXfRv1PhyXQFNC8iTET50KvE/HitdkRgxs=", "owner": "nix-community", "repo": "home-manager", - "rev": "775cb20bd4af7781fbf336fb201df02ee3d544bb", + "rev": "35a24648d155843a4d162de98c17b1afd5db51e4", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-21.05", "repo": "home-manager", "type": "github" } }, "latest": { "locked": { - "lastModified": 1626192309, - "narHash": "sha256-uMl42Cn1Zb3qe8Iw0Rz7x62DUEG1JPCtJNU3ZK5gEFQ=", + "lastModified": 1626529037, + "narHash": "sha256-Q1vbk2fgE43JgjvTBdghZ70ParF2ek/jTn62ACkU8Fw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4036bb94c78329292ef44c233bb42da40b8bd4d2", + "rev": "5f069e17541ac5cd240fced18687cef190080be3", "type": "github" }, "original": { @@ -230,11 +272,11 @@ ] }, "locked": { - "lastModified": 1610392286, - "narHash": "sha256-3wFl5y+4YZO4SgRYK8WE7JIS3p0sxbgrGaQ6RMw+d98=", + "lastModified": 1622810282, + "narHash": "sha256-4wmvM3/xfD0hCdNDIXVzRMfL4yB1J+DjH6Zte2xbAxk=", "owner": "nmattia", "repo": "naersk", - "rev": "d7bfbad3304fd768c0f93a4c3b50976275e6d4be", + "rev": "e8061169e1495871b56be97c5c51d310fae01374", "type": "github" }, "original": { @@ -267,7 +309,7 @@ "nix-dram": { "inputs": { "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1620663773, @@ -283,36 +325,44 @@ "type": "github" } }, - "nixlib": { - "locked": { - "lastModified": 1620519687, - "narHash": "sha256-+6Dd72b2CASuXm2W7KRxZIE7AOy/dj4mU28vaF+zxcs=", - "owner": "divnix", - "repo": "nixpkgs.lib", - "rev": "c7b6169809c5f74dd0c34f3d69e9d12ba4d448de", - "type": "github" - }, - "original": { - "owner": "divnix", - "repo": "nixpkgs.lib", - "type": "github" - } - }, "nixos": { "locked": { - "lastModified": 1626046891, - "narHash": "sha256-Zt8saH+hAehXskW0iFAzk+iMillYoFBxvLReYNqGT9E=", + "lastModified": 1626527571, + "narHash": "sha256-+X2GhKfkuLUYs8wVQPUKZULX3OvaNn2KwrvhoxQk9SA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d8f8f31af9d77a48220e4e8a301d1e79774cb7d2", + "rev": "0a96dbc8b6bd4874ef0f55ce30ec7bdf1cb09452", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-unstable", + "ref": "release-21.05", "type": "indirect" } }, + "nixos-generators": { + "inputs": { + "nixlib": [ + "nixlib" + ], + "nixpkgs": [ + "blank" + ] + }, + "locked": { + "lastModified": 1624973746, + "narHash": "sha256-11JbJRduNwyf556gndGErR5/12ceyHOHBfEuha5Vws4=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "022ef440af8dc237ab1f59fa363cb1e25783ec3e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1625333638, @@ -329,37 +379,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1610942247, - "narHash": "sha256-PKo1ATAlC6BmfYSRmX0TVmNoFbrec+A5OKcabGEu2yU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "7d71001b796340b219d1bfa8552c81995017544a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1620962350, - "narHash": "sha256-9ASW4d4/Z8HmRvuJI8rxbEOTbXTBpQ8y+CmFYBwtXzE=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "5d4a430472cafada97888cc80672fab255231f57", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1620340338, "narHash": "sha256-Op/4K0+Z9Sp5jtFH0s/zMM4H7VFZxrekcAmjQ6JpQ4w=", @@ -377,10 +396,10 @@ }, "nur": { "locked": { - "lastModified": 1626188191, - "narHash": "sha256-63A/IjYpfKb/R+AiWZE6YHsaxkDnYIVSUgPw7QEQnA8=", - "path": "/nix/store/hjc7qr7xsbvx32092bpfsjyi6vk29fg4-source", - "rev": "5caa4740529326001714f4c49a5e9f7b2c40f737", + "lastModified": 1626202371, + "narHash": "sha256-thj8msabJEeAfuC/6Zb4jZnnJ7SfcLUZEY0TjXhFQNs=", + "path": "/nix/store/z9h5jj2b9ls0q3mkvhdz5s05ly7m20k7-source", + "rev": "c10216f94e7e99a05f515a8bdc87d5b460164f1a", "type": "path" }, "original": { @@ -388,20 +407,34 @@ "type": "indirect" } }, - "pkgs": { + "nvfetcher": { "inputs": { + "flake-compat": [ + "digga", + "deploy", + "flake-compat" + ], + "flake-utils": [ + "digga", + "utils", + "flake-utils" + ], "nixpkgs": [ - "nixos" + "latest" ] }, "locked": { - "narHash": "sha256-G+qmA0vMRMgEd0Wp+jMjbOe5Yz+5/Imh+wn6mTWit1o=", - "path": "./pkgs", - "type": "path" + "lastModified": 1626443440, + "narHash": "sha256-9xDWqVcLxAiRC/g/JnSfsj+s/Ont0fZjczAH9pqqBdg=", + "owner": "berberman", + "repo": "nvfetcher", + "rev": "ba3366421ff66a06f4176780dff5e8373512bfba", + "type": "github" }, "original": { - "path": "./pkgs", - "type": "path" + "owner": "berberman", + "repo": "nvfetcher", + "type": "github" } }, "pre-commit-hooks-nix": { @@ -423,44 +456,55 @@ "root": { "inputs": { "agenix": "agenix", + "blank": [ + "digga", + "blank" + ], + "bud": "bud", "ci-agent": "ci-agent", "darwin": "darwin", + "deploy": [ + "digga", + "deploy" + ], "digga": "digga", + "flake-utils": [ + "digga", + "flake-utils" + ], "home": "home", "latest": "latest", "naersk": "naersk_2", "nix-dram": "nix-dram", + "nixlib": [ + "digga", + "nixlib" + ], "nixos": "nixos", "nixos-hardware": "nixos-hardware", + "nixpkgs": [ + "nixos" + ], "nur": "nur", - "pkgs": "pkgs" + "nvfetcher": "nvfetcher", + "utils": [ + "digga", + "utils" + ] } }, "utils": { - "locked": { - "lastModified": 1610051610, - "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "utils_2": { "inputs": { - "flake-utils": "flake-utils" + "flake-utils": [ + "flake-utils" + ] }, "locked": { - "lastModified": 1622583383, - "narHash": "sha256-2DFx619SNfjzYwqx1ryae8zHnTh+N7VsZkbtAbrYIIA=", + "lastModified": 1626288344, + "narHash": "sha256-TioHDqWJkw37jjx4DVrH6LCzwrUfAqXbWl4rKR91fpA=", "owner": "gytis-ivaskevicius", "repo": "flake-utils-plus", - "rev": "6b2ea4b02cad77fac581c6a9ec4f822ba87dce5c", + "rev": "5c6ee69f6957afc2fe22c094717d6d78516418b5", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 973e9074..17708acb 100644 --- a/flake.nix +++ b/flake.nix @@ -1,130 +1,175 @@ { description = "A highly structured configuration database."; + nixConfig.extra-experimental-features = "nix-command flakes ca-references"; + 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="; + inputs = { - nixos.url = "nixpkgs/nixos-unstable"; + nixos.url = "nixpkgs/release-21.05"; latest.url = "nixpkgs"; - digga.url = "github:divnix/digga/master"; - ci-agent = { - url = "github:hercules-ci/hercules-ci-agent"; - inputs = { nix-darwin.follows = "darwin"; nixos-20_09.follows = "nixos"; nixos-unstable.follows = "latest"; }; - }; + digga.url = "github:divnix/digga/develop"; + digga.inputs.nixpkgs.follows = "nixos"; + digga.inputs.nixlib.follows = "nixos"; + digga.inputs.home-manager.follows = "home"; + + bud.url = "github:divnix/bud"; + bud.inputs.nixpkgs.follows = "nixos"; + bud.inputs.devshell.follows = "digga/devshell"; + + home.url = "github:nix-community/home-manager/release-21.05"; + home.inputs.nixpkgs.follows = "nixos"; + darwin.url = "github:LnL7/nix-darwin"; darwin.inputs.nixpkgs.follows = "latest"; - home.url = "github:nix-community/home-manager"; - home.inputs.nixpkgs.follows = "nixos"; - naersk.url = "github:nmattia/naersk"; - naersk.inputs.nixpkgs.follows = "latest"; + + deploy.follows = "digga/deploy"; + agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "latest"; + + nvfetcher.url = "github:berberman/nvfetcher"; + nvfetcher.inputs.nixpkgs.follows = "latest"; + nvfetcher.inputs.flake-compat.follows = "digga/deploy/flake-compat"; + nvfetcher.inputs.flake-utils.follows = "digga/utils/flake-utils"; + + ci-agent.url = "github:hercules-ci/hercules-ci-agent"; + ci-agent.inputs.nix-darwin.follows = "darwin"; + ci-agent.inputs.nixos-20_09.follows = "nixos"; + ci-agent.inputs.nixos-unstable.follows = "latest"; + ci-agent.inputs.flake-compat.follows = "digga/deploy/flake-compat"; + + naersk.url = "github:nmattia/naersk"; + naersk.inputs.nixpkgs.follows = "latest"; + nixos-hardware.url = "github:nixos/nixos-hardware"; - pkgs.url = "path:./pkgs"; - pkgs.inputs.nixpkgs.follows = "nixos"; + # start ANTI CORRUPTION LAYER + # remove after https://github.com/NixOS/nix/pull/4641 + nixpkgs.follows = "nixos"; + nixlib.follows = "digga/nixlib"; + blank.follows = "digga/blank"; + utils.follows = "digga/utils"; + flake-utils.follows = "digga/flake-utils"; + # end ANTI CORRUPTION LAYER # PubSolarOS additions - nix-dram.url = "github:dramforever/nix-dram"; }; outputs = { self - , pkgs , digga + , bud , nixos , ci-agent , home , nixos-hardware , nur , agenix + , nvfetcher + , deploy , nix-dram , ... } @ inputs: - digga.lib.mkFlake { - inherit self inputs; + let + bud' = bud self; # rebind to access self.budModules + in + digga.lib.mkFlake + { + inherit self inputs; - channelsConfig = { allowUnfree = true; }; + channelsConfig = { allowUnfree = true; }; + + channels = { + nixos = { + imports = [ (digga.lib.importers.overlays ./overlays) ]; + overlays = [ + digga.overlays.patchedNix + nur.overlay + agenix.overlay + nvfetcher.overlay + deploy.overlay + nix-dram.overlay + ./pkgs/default.nix + ]; + }; + latest = { }; + }; + + lib = import ./lib { lib = digga.lib // nixos.lib; }; + + sharedOverlays = [ + (final: prev: { + __dontExport = true; + lib = prev.lib.extend (lfinal: lprev: { + our = self.lib; + }); + }) + ]; - channels = { nixos = { - imports = [ (digga.lib.importers.overlays ./overlays) ]; - overlays = [ - ./pkgs/default.nix - pkgs.overlay # for `srcs` - nur.overlay - agenix.overlay - nix-dram.overlay - ]; - }; - latest = { }; - }; - - lib = import ./lib { lib = digga.lib // nixos.lib; }; - - sharedOverlays = [ - (final: prev: { - lib = prev.lib.extend (lfinal: lprev: { - our = self.lib; - }); - }) - ]; - - nixos = { - hostDefaults = { - system = "x86_64-linux"; - channelName = "nixos"; - modules = ./modules/module-list.nix; - externalModules = [ - { _module.args.ourLib = self.lib; } - ci-agent.nixosModules.agent-profile - home.nixosModules.home-manager - agenix.nixosModules.age - ./modules/customBuilds.nix - ]; - }; - - imports = [ (digga.lib.importers.hosts ./hosts) ]; - hosts = { - /* set host specific properties here */ - NixOS = { }; - }; - importables = rec { - profiles = digga.lib.importers.rakeLeaves ./profiles // { - users = digga.lib.importers.rakeLeaves ./users; + hostDefaults = { + system = "x86_64-linux"; + channelName = "nixos"; + imports = [ (digga.lib.importers.modules ./modules) ]; + externalModules = [ + { lib.our = self.lib; } + digga.nixosModules.nixConfig + ci-agent.nixosModules.agent-profile + home.nixosModules.home-manager + agenix.nixosModules.age + (bud.nixosModules.bud bud') + ]; }; - suites = with profiles; rec { - base = [ core users.nixos users.root ]; - pubsolaros = [ core base-user users.root ]; - anonymous = [ pubsolaros users.nixos ]; + + imports = [ (digga.lib.importers.hosts ./hosts) ]; + hosts = { + /* set host specific properties here */ + NixOS = { }; + }; + importables = rec { + profiles = digga.lib.importers.rakeLeaves ./profiles // { + users = digga.lib.importers.rakeLeaves ./users; + }; + suites = with profiles; rec { + base = [ core users.nixos users.root ]; + pubsolaros = [ core base-user users.root ]; + anonymous = [ pubsolaros users.nixos ]; + }; }; }; - }; - home = { - modules = ./users/modules/module-list.nix; - externalModules = [ ]; - importables = rec { - profiles = digga.lib.importers.rakeLeaves ./users/profiles; - suites = with profiles; rec { - base = [ direnv git ]; + home = { + imports = [ (digga.lib.importers.modules ./users/modules) ]; + externalModules = [ ]; + importables = rec { + profiles = digga.lib.importers.rakeLeaves ./users/profiles; + suites = with profiles; rec { + base = [ direnv git ]; + }; }; + users = { + nixos = { suites, ... }: { imports = suites.base; }; + }; # digga.lib.importers.rakeLeaves ./users/hm; }; - }; - devshell.externalModules = { pkgs, ... }: { - packages = [ pkgs.agenix ]; - }; + devshell.modules = [ (import ./shell bud') ]; - homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; + homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; - deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; + deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; - defaultTemplate = self.templates.flk; - templates.flk.path = ./.; - templates.flk.description = "flk template"; + defaultTemplate = self.templates.bud; + templates.bud.path = ./.; + templates.bud.description = "bud template"; + } + // + { + budModules = { devos = import ./pkgs/bud; }; } ; } diff --git a/modules/customBuilds.nix b/modules/customBuilds.nix index 7181f65e..d7757c6b 100644 --- a/modules/customBuilds.nix +++ b/modules/customBuilds.nix @@ -1,33 +1,11 @@ -{ lib, self, diggaLib, config, modules, channel, ... }: -let - mkBuild = buildModule: - # TODO: get specialArgs as a module argument and drop builderArgs usage - channel.input.lib.nixosSystem (diggaLib.mergeAny config.lib.builderArgs { - modules = [ buildModule ]; - }); -in +{ lib, pkgs, self, config, modules, channel, ... }: { system.build = { - iso = (mkBuild (diggaLib.modules.isoConfig { - inherit self; - fullHostConfig = config; - })).config.system.build.isoImage; - - homes = (mkBuild ({ config, ... }: { - home-manager.useUserPackages = lib.mkForce false; - home-manager.sharedModules = [ - { - home.sessionVariables = { - inherit (config.environment.sessionVariables) NIX_PATH; - }; - xdg.configFile."nix/registry.json".text = - config.environment.etc."nix/registry.json".text; - } - ]; - })).config.home-manager.users; - - digitalOcean = (mkBuild ({ modulesPath, ... }: { - imports = [ "${modulesPath}/virtualisation/digital-ocean-image.nix" ]; - })).config.system.build.digitalOceanImage; + iso = (config.lib.digga.mkBuild + (config.lib.digga.modules.isoConfig { + inherit self; + fullHostConfig = config; + }) + ).config.system.build.isoImage; }; } diff --git a/modules/hm-system-defaults.nix b/modules/hm-system-defaults.nix new file mode 100644 index 00000000..7b442a61 --- /dev/null +++ b/modules/hm-system-defaults.nix @@ -0,0 +1,11 @@ +{ config, ... }: { + home-manager.sharedModules = [ + { + home.sessionVariables = { + inherit (config.environment.sessionVariables) NIX_PATH; + }; + xdg.configFile."nix/registry.json".text = + config.environment.etc."nix/registry.json".text; + } + ]; +} diff --git a/modules/module-list.nix b/modules/module-list.nix deleted file mode 100644 index 35cf4abe..00000000 --- a/modules/module-list.nix +++ /dev/null @@ -1,21 +0,0 @@ -[ - ./compat - ./user - ./x-os - ./sway - ./graphical - ./docker - ./audio - ./email - ./crypto - ./nextcloud - ./gaming - ./virtualisation - ./social - ./devops - ./terminal-life - ./server - ./printing - ./office - ./uhk -] diff --git a/modules/nix-path.nix b/modules/nix-path.nix new file mode 100644 index 00000000..273f67a6 --- /dev/null +++ b/modules/nix-path.nix @@ -0,0 +1,7 @@ +{ channel, inputs, ... }: { + nix.nixPath = [ + "nixpkgs=${channel.input}" + "nixos-config=${../lib/compat/nixos}" + "home-manager=${inputs.home}" + ]; +} diff --git a/modules/sway/config/config b/modules/sway/config/config index 2360c062..752a96c5 100644 --- a/modules/sway/config/config +++ b/modules/sway/config/config @@ -125,7 +125,7 @@ output * bg ~/.config/wallpaper.jpg fill 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 @@ -141,13 +141,13 @@ output * bg ~/.config/wallpaper.jpg fill # 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 + font xft:Hack 16 # You can "split" the current object of your focus with # $mod+b or $mod+v, for horizontal and vertical splits diff --git a/modules/sway/config/config.d/gaps.conf b/modules/sway/config/config.d/gaps.conf index f0a17661..0dcc5087 100644 --- a/modules/sway/config/config.d/gaps.conf +++ b/modules/sway/config/config.d/gaps.conf @@ -10,7 +10,7 @@ gaps outer -5 # Smart gaps (gaps used if only more than one container on the workspace) smart_gaps on -# Smart borders (draw borders around container only if it is not the only container on this workspace) +# Smart borders (draw borders around container only if it is not the only container on this workspace) # on|no_gaps (on=always activate and no_gaps=only activate if the gap size to the edge of the screen is 0) smart_borders on diff --git a/modules/sway/config/config.d/systemd.conf b/modules/sway/config/config.d/systemd.conf index ceb273f8..3fecd355 100644 --- a/modules/sway/config/config.d/systemd.conf +++ b/modules/sway/config/config.d/systemd.conf @@ -1,5 +1,5 @@ # Note that the systemctl commands must be run synchronously and can't be split into -# three exec statements, since otherwise the session target may be started before +# three exec statements, since otherwise the session target may be started before # systemctl import-environment is complete, and services that require certain variables # will fail to run. # https://github.com/swaywm/sway/wiki/Systemd-integration diff --git a/modules/terminal-life/zsh/p10k.zsh b/modules/terminal-life/zsh/p10k.zsh index 64503895..be207b58 100644 --- a/modules/terminal-life/zsh/p10k.zsh +++ b/modules/terminal-life/zsh/p10k.zsh @@ -596,7 +596,7 @@ typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=172 # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' - + ###########[ nix_shell ]########### # # Nix shell color. typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74 diff --git a/overlays/manix.nix b/overlays/manix.nix new file mode 100644 index 00000000..d39baa74 --- /dev/null +++ b/overlays/manix.nix @@ -0,0 +1,5 @@ +final: prev: { + manix = prev.manix.overrideAttrs (o: rec{ + inherit (prev.sources.manix) pname version src; + }); +} diff --git a/overlays/overrides.nix b/overlays/overrides.nix index 502a0754..53ec6635 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -7,7 +7,6 @@ channels: final: prev: { dhall discord element-desktop - manix rage neovim-unwrapped nixpkgs-fmt @@ -16,15 +15,15 @@ channels: final: prev: { starship; - haskellPackages = prev.haskellPackages.override { - overrides = hfinal: hprev: - let version = prev.lib.replaceChars [ "." ] [ "" ] prev.ghc.version; - in - { - # same for haskell packages, matching ghc versions - inherit (channels.latest.haskell.packages."ghc${version}") - haskell-language-server; - }; - }; - + haskellPackages = prev.haskellPackages.override + (old: { + overrides = prev.lib.composeExtensions (old.overrides or (_: _: { })) (hfinal: hprev: + let version = prev.lib.replaceChars [ "." ] [ "" ] prev.ghc.version; + in + { + # same for haskell packages, matching ghc versions + inherit (channels.latest.haskell.packages."ghc${version}") + haskell-language-server; + }); + }); } diff --git a/overlays/various-flake-fixes.nix b/overlays/various-flake-fixes.nix new file mode 100644 index 00000000..7dbfc18b --- /dev/null +++ b/overlays/various-flake-fixes.nix @@ -0,0 +1,11 @@ +final: prev: { + # Since: https://github.com/NixOS/nixpkgs/pull/126137 + nix-direnv = + if builtins.hasAttr "enableFlakes" prev.nix-direnv.override.__functionArgs + then + prev.nix-direnv.override + { + enableFlakes = true; + } + else prev.nix-direnv; +} diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix new file mode 100644 index 00000000..0d13ac01 --- /dev/null +++ b/pkgs/_sources/generated.nix @@ -0,0 +1,17 @@ +# This file was generated by nvfetcher, please do not modify it manually. +{ fetchgit, fetchurl }: +{ + manix = { + pname = "manix"; + version = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; + src = fetchgit { + url = "https://github.com/mlvzk/manix"; + rev = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; + fetchSubmodules = false; + deepClone = false; + leaveDotGit = false; + sha256 = "1b7xi8c2drbwzfz70czddc4j33s7g1alirv12dwl91hbqxifx8qs"; + }; + + }; +} diff --git a/pkgs/bud/default.nix b/pkgs/bud/default.nix new file mode 100644 index 00000000..c486636b --- /dev/null +++ b/pkgs/bud/default.nix @@ -0,0 +1,10 @@ +{ 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/pkgs/bud/get.bash b/pkgs/bud/get.bash new file mode 100644 index 00000000..3b4d9a74 --- /dev/null +++ b/pkgs/bud/get.bash @@ -0,0 +1 @@ +nix flake new -t "github:divnix/devos/core" "${2:-devos}" diff --git a/pkgs/default.nix b/pkgs/default.nix index 935206d9..a096f93e 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,15 +1,18 @@ final: prev: -with final; { - import-gtk-settings = writeShellScriptBin "import-gtk-settings" (import ./import-gtk-settings.nix final); - mailto-mutt = writeShellScriptBin "mailto-mutt" (import ./mailto-mutt.nix final); - mopidy-jellyfin = import ./mopidy-jellyfin.nix final; - mu = writeShellScriptBin "mu" (import ./mu.nix final); - psos = writeShellScriptBin "psos" (import ./psos.nix final); - s = writeShellScriptBin "s" (import ./s.nix final); - sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final); - sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final); - swaylock-bg = writeScriptBin "swaylock-bg" (import ./swaylock-bg.nix 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); + with final; { + # keep sources this first + sources = prev.callPackage (import ./_sources/generated.nix) { }; + # then, call packages with `final.callPackage` + import-gtk-settings = writeShellScriptBin "import-gtk-settings" (import ./import-gtk-settings.nix final); + mailto-mutt = writeShellScriptBin "mailto-mutt" (import ./mailto-mutt.nix final); + mopidy-jellyfin = import ./mopidy-jellyfin.nix final; + mu = writeShellScriptBin "mu" (import ./mu.nix final); + psos = writeShellScriptBin "psos" (import ./psos.nix final); + s = writeShellScriptBin "s" (import ./s.nix final); + sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final); + sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final); + swaylock-bg = writeScriptBin "swaylock-bg" (import ./swaylock-bg.nix 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); } diff --git a/pkgs/flake.lock b/pkgs/flake.lock deleted file mode 100644 index ef3f5a9a..00000000 --- a/pkgs/flake.lock +++ /dev/null @@ -1,25 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1615926763, - "narHash": "sha256-yeq8A3EPNuQVlsxlEQrIRsklfJwJK0Us6jtcG/u8wNs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "b702a56d417647de4090ac56c0f18bdc7e646610", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/pkgs/flake.nix b/pkgs/flake.nix deleted file mode 100644 index 1b6cc0a2..00000000 --- a/pkgs/flake.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - description = "Package Sources"; - - inputs = { }; - - outputs = { self, nixpkgs, ... }: { - overlay = final: prev: { - inherit (self) srcs; - }; - - srcs = - let - inherit (nixpkgs) lib; - - mkVersion = name: input: - let - inputs = (builtins.fromJSON - (builtins.readFile ./flake.lock)).nodes; - - ref = - if lib.hasAttrByPath [ name "original" "ref" ] inputs - then inputs.${name}.original.ref - else ""; - - version = - let version' = builtins.match - "[[:alpha:]]*[-._]?([0-9]+(\.[0-9]+)*)+" - ref; - in - if lib.isList version' - then lib.head version' - else if input ? lastModifiedDate && input ? shortRev - then "${lib.substring 0 8 input.lastModifiedDate}_${input.shortRev}" - else null; - in - version; - in - lib.mapAttrs - (pname: input: - let - version = mkVersion pname input; - in - input // { inherit pname; } - // lib.optionalAttrs (! isNull version) - { - inherit version; - } - ) - (lib.filterAttrs (n: _: n != "nixpkgs") - self.inputs); - }; -} diff --git a/pkgs/sources.toml b/pkgs/sources.toml new file mode 100644 index 00000000..f7af168e --- /dev/null +++ b/pkgs/sources.toml @@ -0,0 +1,4 @@ +# nvfetcher.toml +[manix] +src.git = "https://github.com/mlvzk/manix" +fetch.github = "mlvzk/manix" diff --git a/profiles/base-user/.config/dircolors b/profiles/base-user/.config/dircolors index 89c085da..16b9bb1b 100644 --- a/profiles/base-user/.config/dircolors +++ b/profiles/base-user/.config/dircolors @@ -116,7 +116,7 @@ EXEC 01;32 #.sh 01;32 #.csh 01;32 - # archives or compressed (bright red) +# archives or compressed (bright red) .tar 01;31 .tgz 01;31 .arc 01;31 diff --git a/profiles/base-user/.config/mutt/mailcap b/profiles/base-user/.config/mutt/mailcap index f6cb96a1..86035375 100644 --- a/profiles/base-user/.config/mutt/mailcap +++ b/profiles/base-user/.config/mutt/mailcap @@ -1 +1 @@ -text/html; w3m -I %{charset} -T text/html; copiousoutput; +text/html; w3m -I %{charset} -T text/html; copiousoutput; diff --git a/profiles/base-user/.config/user-dirs.dirs b/profiles/base-user/.config/user-dirs.dirs index 5a833b8f..a1bf8b4d 100644 --- a/profiles/base-user/.config/user-dirs.dirs +++ b/profiles/base-user/.config/user-dirs.dirs @@ -4,7 +4,7 @@ # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an # absolute path. No other format is supported. -# + XDG_DESKTOP_DIR="$HOME/" XDG_DOWNLOAD_DIR="$HOME/Downloads" XDG_TEMPLATES_DIR="$HOME/Templates" diff --git a/profiles/base-user/.config/user-dirs.locale b/profiles/base-user/.config/user-dirs.locale index 3e0b4191..7741b83a 100644 --- a/profiles/base-user/.config/user-dirs.locale +++ b/profiles/base-user/.config/user-dirs.locale @@ -1 +1 @@ -en_US \ No newline at end of file +en_US diff --git a/profiles/base-user/.config/vifm/vifmrc b/profiles/base-user/.config/vifm/vifmrc index 3a10e173..400aea0d 100644 --- a/profiles/base-user/.config/vifm/vifmrc +++ b/profiles/base-user/.config/vifm/vifmrc @@ -195,26 +195,26 @@ filextype *.djvu " Audio filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus - \ {Play using vlc} - \ vlc %c, - \ {Play using ffplay} - \ ffplay -nodisp -autoexit %c, + \ {Play using vlc} + \ vlc %c, + \ {Play using ffplay} + \ ffplay -nodisp -autoexit %c, fileviewer *.mp3 mp3info fileviewer *.flac soxi " Video filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, - \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, - \*.as[fx] + \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, + \*.as[fx] \ {View using vlc} \ vlc %f, \ {View using ffplay} \ ffplay -fs -autoexit %f, fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, - \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, - \*.as[fx] - \ vifmimg videopreview %px %py %pw %ph %c - \ %pc + \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, + \*.as[fx] + \ vifmimg videopreview %px %py %pw %ph %c + \ %pc \ vifmimg clear " \ ffprobe -pretty %c 2>&1 @@ -242,7 +242,7 @@ fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm \ %pc \ vifmimg clear " Get w3m image previews inside vifm - " \ imgt %px %py %pw %ph %c + " \ imgt %px %py %pw %ph %c " \ %pc " \ imgc %px %py %pw %ph NOT NEEDED IN XTERM fileviewer *.gif @@ -262,28 +262,28 @@ filextype *.vym " MD5 filetype *.md5 - \ {Check MD5 hash sum} - \ md5sum -c %f %S, + \ {Check MD5 hash sum} + \ md5sum -c %f %S, " SHA1 filetype *.sha1 - \ {Check SHA1 hash sum} - \ sha1sum -c %f %S, + \ {Check SHA1 hash sum} + \ sha1sum -c %f %S, " SHA256 filetype *.sha256 - \ {Check SHA256 hash sum} - \ sha256sum -c %f %S, + \ {Check SHA256 hash sum} + \ sha256sum -c %f %S, " SHA512 filetype *.sha512 - \ {Check SHA512 hash sum} - \ sha512sum -c %f %S, + \ {Check SHA512 hash sum} + \ sha512sum -c %f %S, " GPG signature filetype *.asc - \ {Check signature} - \ !!gpg --verify %c, + \ {Check signature} + \ !!gpg --verify %c, " Torrent filetype *.torrent ktorrent %f & @@ -291,18 +291,18 @@ fileviewer *.torrent dumptorrent -v %c " FuseZipMount filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg - \ {Mount with fuse-zip} - \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, - \ {View contents} - \ zip -sf %c | less, - \ {Extract here} - \ tar -xf %c, + \ {Mount with fuse-zip} + \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, + \ {View contents} + \ zip -sf %c | less, + \ {Extract here} + \ tar -xf %c, fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c " ArchiveMount filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz - \ {Mount with archivemount} - \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR, + \ {Mount with archivemount} + \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR, fileviewer *.tgz,*.tar.gz tar -tzf %c fileviewer *.tar.bz2,*.tbz2 tar -tjf %c fileviewer *.tar.txz,*.txz xz --list %c @@ -310,29 +310,29 @@ fileviewer *.tar tar -tf %c " Rar2FsMount and rar archives filetype *.rar - \ {Mount with rar2fs} - \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR, + \ {Mount with rar2fs} + \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR, fileviewer *.rar unrar v %c " IsoMount filetype *.iso - \ {Mount with fuseiso} - \ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR, + \ {Mount with fuseiso} + \ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR, " SshMount filetype *.ssh - \ {Mount with sshfs} - \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND, + \ {Mount with sshfs} + \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND, " FtpMount filetype *.ftp - \ {Mount with curlftpfs} - \ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND, + \ {Mount with curlftpfs} + \ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND, " Fuse7z and 7z archives filetype *.7z - \ {Mount with fuse-7z} - \ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR, + \ {Mount with fuse-7z} + \ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR, fileviewer *.7z 7z l %c " Office files @@ -348,8 +348,8 @@ filextype *.pro qtcreator %f & " All others filetype *.ts,*.js,*.css,*.sass,*.scss,*.go,*.rs,*.py,*.html,*.xhtml,*.json,*.jsx,*.tsx,*.vue,*.svelte,*.sql - \ {Open in editor} - \ nvim %c, + \ {Open in editor} + \ nvim %c, fileviewer *.ts,*.js,*.css,*.sass,*.scss,*.go,*.rs,*.py,*.html,*.xhtml,*.json,*.jsx,*.tsx,*.vue,*.svelte,*.sql bat %c " Directories diff --git a/profiles/base-user/.config/waybar/config b/profiles/base-user/.config/waybar/config index b2231671..3ac2f37a 100644 --- a/profiles/base-user/.config/waybar/config +++ b/profiles/base-user/.config/waybar/config @@ -1,102 +1,102 @@ { - "layer": "top", // Waybar at top layer - // "position": "bottom", // Waybar position (top|bottom|left|right) + "layer": "top", // Waybar at top layer + // "position": "bottom", // Waybar position (top|bottom|left|right) - "height": 26, // Waybar height - "modules-left": ["sway/workspaces", "sway/mode"], - "modules-center": ["mpd"], - "modules-right": ["sway/language", "pulseaudio", "network", "idle_inhibitor", "battery", "clock", "tray"], - "sway/workspaces": { - "disable-scroll": true - }, - "sway/mode": { - "tooltip": false, - "format": "{}" - }, - "sway/window": { - "tooltip": false, - "max-length": 96 - }, - "sway/language": { + "height": 26, // Waybar height + "modules-left": ["sway/workspaces", "sway/mode"], + "modules-center": ["mpd"], + "modules-right": ["sway/language", "pulseaudio", "network", "idle_inhibitor", "battery", "clock", "tray"], + "sway/workspaces": { + "disable-scroll": true + }, + "sway/mode": { + "tooltip": false, + "format": "{}" + }, + "sway/window": { + "tooltip": false, + "max-length": 96 + }, + "sway/language": { "format": "{}", "max-length": 50 - }, - "tray": { - "icon-size": 21, - "spacing": 10 - }, - "clock": { - "tooltip-format": "{:%Y %B}\n{calendar}", - "format-alt": "{:%a %d. %h %H:%M}" - }, - "backlight": { - // "device": "acpi_video1", - "tooltip": true, - "tooltip-format": "Brightness: {percent}%", - "format": "{icon}", - "format-icons": ["", ""] + }, + "tray": { + "icon-size": 21, + "spacing": 10 + }, + "clock": { + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "{:%a %d. %h %H:%M}" + }, + "backlight": { + // "device": "acpi_video1", + "tooltip": true, + "tooltip-format": "Brightness: {percent}%", + "format": "{icon}", + "format-icons": ["", ""] + }, + "cpu": { + "format": "{}% " + }, + "memory": { + "format": "{}% " + }, + "idle_inhibitor": { + "format": "{icon} ", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "battery": { + "tooltip": false, + "states": { + "critical": 25 }, - "cpu": { - "format": "{}% " - }, - "memory": { - "format": "{}% " - }, - "idle_inhibitor": { - "format": "{icon} ", - "format-icons": { - "activated": "", - "deactivated": "" - } + "full-at": 84, + "format": "{icon} {capacity}%", + "format-full": "{icon}", + "format-icons": ["", "", "", "", ""], + }, + "network": { + "interval": 3, + "tooltip": true, + //"interface": "wlp4s0", // (Optional) To force the use of this interface   \uF2E7, + "format-wifi": " \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}", + "format-ethernet": " \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}", + "format-disconnected": "", + "tooltip-format-wifi": "{essid} ({signalStrength}%)  {ipaddr}", + "tooltip-format-ethernet": "{ifname}  {ipaddr}" + }, + //\ue04f{volume}% + "pulseaudio": { + "tooltip": false, + "format": "{volume}% {icon}", + "format-bluetooth": "{volume}% {icon}", + "format-muted": "", + "on-click": "pavucontrol", + "format-alt": "{volume}% {icon}", + "format-icons": { + "headphones": "", + "handsfree": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["","", ""] + } + }, + "mpd": { + "format": "{artist} - {title} [{elapsedTime:%M:%S} / {totalTime:%M:%S}]", + "format-disconnected": "", + "format-stopped": "", + "interval": 1, + "state-icons": { + "paused": "", + "playing": "" }, - "battery": { - "tooltip": false, - "states": { - "critical": 25 - }, - "full-at": 84, - "format": "{icon} {capacity}%", - "format-full": "{icon}", - "format-icons": ["", "", "", "", ""], - }, - "network": { - "interval": 3, - "tooltip": true, - //"interface": "wlp4s0", // (Optional) To force the use of this interface   \uF2E7, - "format-wifi": " \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}", - "format-ethernet": " \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}", - "format-disconnected": "", - "tooltip-format-wifi": "{essid} ({signalStrength}%)  {ipaddr}", - "tooltip-format-ethernet": "{ifname}  {ipaddr}" - }, - //\ue04f{volume}% - "pulseaudio": { - "tooltip": false, - "format": "{volume}% {icon}", - "format-bluetooth": "{volume}% {icon}", - "format-muted": "", - "on-click": "pavucontrol", - "format-alt": "{volume}% {icon}", - "format-icons": { - "headphones": "", - "handsfree": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": ["","", ""] - } - }, - "mpd": { - "format": "{artist} - {title} [{elapsedTime:%M:%S} / {totalTime:%M:%S}]", - "format-disconnected": "", - "format-stopped": "", - "interval": 1, - "state-icons": { - "paused": "", - "playing": "" - }, - "tooltip-format": "MPD (connected)", - "tooltip-format-disconnected": "MPD (disconnected)" - } + "tooltip-format": "MPD (connected)", + "tooltip-format-disconnected": "MPD (disconnected)" + } } diff --git a/profiles/base-user/.config/waybar/style.css b/profiles/base-user/.config/waybar/style.css index f4e07cce..ef85a95a 100644 --- a/profiles/base-user/.config/waybar/style.css +++ b/profiles/base-user/.config/waybar/style.css @@ -51,7 +51,7 @@ window#waybar { } #battery.critical { - color: @base07; + color: @base07; } #battery.charging { color: @base0B; diff --git a/profiles/base-user/.xinitrc b/profiles/base-user/.xinitrc index 3c317bfb..d961f66c 100644 --- a/profiles/base-user/.xinitrc +++ b/profiles/base-user/.xinitrc @@ -46,28 +46,28 @@ if [ -d /etc/X11/xinit/xinitrc.d ] ; then fi get_session(){ - local dbus_args=(--sh-syntax --exit-with-session) - case $1 in - awesome) dbus_args+=(awesome) ;; - bspwm) dbus_args+=(bspwm-session) ;; - budgie) dbus_args+=(budgie-desktop) ;; - cinnamon) dbus_args+=(cinnamon-session) ;; - deepin) dbus_args+=(startdde) ;; - enlightenment) dbus_args+=(enlightenment_start) ;; - fluxbox) dbus_args+=(startfluxbox) ;; - gnome) dbus_args+=(gnome-session) ;; - i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;; - jwm) dbus_args+=(jwm) ;; - kde) dbus_args+=(startkde) ;; - lxde) dbus_args+=(startlxde) ;; - lxqt) dbus_args+=(lxqt-session) ;; - mate) dbus_args+=(mate-session) ;; - xfce) dbus_args+=(xfce4-session) ;; - openbox) dbus_args+=(openbox-session) ;; - *) dbus_args+=($DEFAULT_SESSION) ;; - esac + local dbus_args=(--sh-syntax --exit-with-session) + case $1 in + awesome) dbus_args+=(awesome) ;; + bspwm) dbus_args+=(bspwm-session) ;; + budgie) dbus_args+=(budgie-desktop) ;; + cinnamon) dbus_args+=(cinnamon-session) ;; + deepin) dbus_args+=(startdde) ;; + enlightenment) dbus_args+=(enlightenment_start) ;; + fluxbox) dbus_args+=(startfluxbox) ;; + gnome) dbus_args+=(gnome-session) ;; + i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;; + jwm) dbus_args+=(jwm) ;; + kde) dbus_args+=(startkde) ;; + lxde) dbus_args+=(startlxde) ;; + lxqt) dbus_args+=(lxqt-session) ;; + mate) dbus_args+=(mate-session) ;; + xfce) dbus_args+=(xfce4-session) ;; + openbox) dbus_args+=(openbox-session) ;; + *) dbus_args+=($DEFAULT_SESSION) ;; + esac - echo "dbus-launch ${dbus_args[*]}" + echo "dbus-launch ${dbus_args[*]}" } exec $(get_session) diff --git a/shell/default.nix b/shell/default.nix new file mode 100644 index 00000000..edad83c0 --- /dev/null +++ b/shell/default.nix @@ -0,0 +1,63 @@ +bud: +{ pkgs, extraModulesPath, ... }: +let + + hooks = import ./hooks; + + pkgWithCategory = category: package: { inherit package category; }; + linter = pkgWithCategory "linter"; + docs = pkgWithCategory "docs"; + devos = pkgWithCategory "devos"; + +in +{ + _file = toString ./.; + + imports = [ "${extraModulesPath}/git/hooks.nix" ]; + git = { inherit hooks; }; + + # tempfix: remove when merged https://github.com/numtide/devshell/pull/123 + devshell.startup.load_profiles = pkgs.lib.mkForce (pkgs.lib.noDepEntry '' + # PATH is devshell's exorbitant privilige: + # fence against its pollution + _PATH=''${PATH} + # Load installed profiles + for file in "$DEVSHELL_DIR/etc/profile.d/"*.sh; do + # If that folder doesn't exist, bash loves to return the whole glob + [[ -f "$file" ]] && source "$file" + done + # Exert exorbitant privilige and leave no trace + export PATH=''${_PATH} + unset _PATH + ''); + + packages = with pkgs; [ + git-crypt + ]; + + commands = with pkgs; [ + (devos (bud { inherit pkgs; })) + (devos nixUnstable) + (devos agenix) + { + category = "devos"; + name = pkgs.nvfetcher-bin.pname; + help = pkgs.nvfetcher-bin.meta.description; + command = "cd $DEVSHELL_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml --no-output $@; nixpkgs-fmt _sources/"; + } + (linter nixpkgs-fmt) + (linter editorconfig-checker) + # (docs python3Packages.grip) too many deps + (docs mdbook) + ] + + ++ lib.optional + (pkgs ? deploy-rs) + (devos deploy-rs.deploy-rs) + + ++ lib.optional + (system != "i686-linux") + (devos cachix) + + ; +} diff --git a/shell/hooks/default.nix b/shell/hooks/default.nix new file mode 100644 index 00000000..10f2c9d2 --- /dev/null +++ b/shell/hooks/default.nix @@ -0,0 +1,4 @@ +{ + enable = true; + pre-commit.text = builtins.readFile ./pre-commit.sh; +} diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh new file mode 100755 index 00000000..985d3b40 --- /dev/null +++ b/shell/hooks/pre-commit.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(${git}/bin/git hash-object -t tree /dev/null) +fi + +diff="git diff-index --name-only --cached $against --diff-filter d" + +nix_files=($($diff -- '*.nix')) +all_files=($($diff)) + +# Format staged nix files. +if [[ -n "${nix_files[@]}" ]]; then + nixpkgs-fmt "${nix_files[@]}" \ + && git add "${nix_files[@]}" +fi + +# check editorconfig +editorconfig-checker -- "${all_files[@]}" +if [[ $? != '0' ]]; then + printf "%b\n" \ + "\nCode is not aligned with .editorconfig" \ + "Review the output and commit your fixes" >&2 + exit 1 +fi diff --git a/users/modules/.flake-keep b/users/modules/.flake-keep new file mode 100644 index 00000000..e69de29b diff --git a/users/modules/module-list.nix b/users/modules/module-list.nix deleted file mode 100644 index 1e3ec721..00000000 --- a/users/modules/module-list.nix +++ /dev/null @@ -1 +0,0 @@ -[ ] diff --git a/users/nixos/default.nix b/users/nixos/default.nix index 700467b9..5c037fe8 100644 --- a/users/nixos/default.nix +++ b/users/nixos/default.nix @@ -1,8 +1,6 @@ -{ ... }: +{ hmUsers, ... }: { - home-manager.users.nixos = { suites, ... }: { - imports = suites.base; - }; + home-manager.users = { inherit (hmUsers) nixos; }; users.users.nixos = { uid = 1000; diff --git a/users/profiles/direnv/default.nix b/users/profiles/direnv/default.nix index 173a9c58..2b51c9d2 100644 --- a/users/profiles/direnv/default.nix +++ b/users/profiles/direnv/default.nix @@ -1,6 +1,6 @@ { programs.direnv = { enable = true; - enableNixDirenvIntegration = true; + nix-direnv.enable = true; }; }