diff --git a/flake.nix b/flake.nix index 3a6f8997..700de7a8 100755 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,8 @@ { description = "Isabel's dotfiles"; - outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { imports = [ ./parts ]; }; + outputs = + inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { imports = [ ./modules/flake ]; }; inputs = { # our main package supplier @@ -41,7 +42,6 @@ inputs = { nixpkgs.follows = "nixpkgs"; flake-compat.follows = ""; - flake-utils.follows = "flake-utils"; }; }; diff --git a/parts/args.nix b/modules/flake/args.nix similarity index 100% rename from parts/args.nix rename to modules/flake/args.nix diff --git a/modules/flake/checks/default.nix b/modules/flake/checks/default.nix new file mode 100644 index 00000000..6f924c78 --- /dev/null +++ b/modules/flake/checks/default.nix @@ -0,0 +1,3 @@ +{ + imports = [ ./lib.nix ]; +} diff --git a/parts/checks/lib.nix b/modules/flake/checks/lib.nix similarity index 100% rename from parts/checks/lib.nix rename to modules/flake/checks/lib.nix diff --git a/parts/default.nix b/modules/flake/default.nix similarity index 70% rename from parts/default.nix rename to modules/flake/default.nix index 883cabf1..19ec75fb 100644 --- a/parts/default.nix +++ b/modules/flake/default.nix @@ -1,11 +1,11 @@ { imports = [ - ../systems # the host systems configurations + ../../systems # the host systems configurations ./checks # custom checks that are devised to test if the system is working as expected ./lib # the lib that is used in the system - ./modules # nixos and home-manager modules - ./overlays # nixpkgs overlays for custom packages and patches + ./modules.nix # nixos and home-manager modules + ./overlays.nix # nixpkgs overlays for custom packages and patches ./packages # our custom packages provided by the flake ./programs # programs that run in the dev shell ./templates # programing templates for the quick setup of new programing environments diff --git a/parts/lib/default.nix b/modules/flake/lib/default.nix similarity index 100% rename from parts/lib/default.nix rename to modules/flake/lib/default.nix diff --git a/parts/lib/hardware.nix b/modules/flake/lib/hardware.nix similarity index 100% rename from parts/lib/hardware.nix rename to modules/flake/lib/hardware.nix diff --git a/parts/lib/helpers.nix b/modules/flake/lib/helpers.nix similarity index 100% rename from parts/lib/helpers.nix rename to modules/flake/lib/helpers.nix diff --git a/parts/lib/programs.nix b/modules/flake/lib/programs.nix similarity index 100% rename from parts/lib/programs.nix rename to modules/flake/lib/programs.nix diff --git a/parts/lib/secrets.nix b/modules/flake/lib/secrets.nix similarity index 100% rename from parts/lib/secrets.nix rename to modules/flake/lib/secrets.nix diff --git a/parts/lib/services.nix b/modules/flake/lib/services.nix similarity index 100% rename from parts/lib/services.nix rename to modules/flake/lib/services.nix diff --git a/parts/lib/template/default.nix b/modules/flake/lib/template/default.nix similarity index 100% rename from parts/lib/template/default.nix rename to modules/flake/lib/template/default.nix diff --git a/parts/lib/template/xdg.nix b/modules/flake/lib/template/xdg.nix similarity index 100% rename from parts/lib/template/xdg.nix rename to modules/flake/lib/template/xdg.nix diff --git a/parts/lib/validators.nix b/modules/flake/lib/validators.nix similarity index 100% rename from parts/lib/validators.nix rename to modules/flake/lib/validators.nix diff --git a/parts/modules/default.nix b/modules/flake/modules.nix similarity index 100% rename from parts/modules/default.nix rename to modules/flake/modules.nix diff --git a/parts/overlays/default.nix b/modules/flake/overlays.nix similarity index 100% rename from parts/overlays/default.nix rename to modules/flake/overlays.nix diff --git a/modules/flake/packages/default.nix b/modules/flake/packages/default.nix new file mode 100644 index 00000000..0074b839 --- /dev/null +++ b/modules/flake/packages/default.nix @@ -0,0 +1,24 @@ +# I would highly advise you do not use my flake as an input and instead you vendor this +# if you want to use this code, you may want to add my cachix cache to your flake +# you may want to not have to build this for yourself however +{ inputs, ... }: +{ + perSystem = + { pkgs, inputs', ... }: + let + inherit (pkgs) callPackage; + in + { + packages = { + inherit (callPackage ./pkgs/scripts/package.nix { }) + preview + icat + extract + scripts + ; + + lix = callPackage ./pkgs/lix/package.nix { inherit inputs' inputs; }; + docs = callPackage ./pkgs/docs.nix { inherit (inputs) self; }; + }; + }; +} diff --git a/parts/packages/docs.nix b/modules/flake/packages/pkgs/docs.nix similarity index 97% rename from parts/packages/docs.nix rename to modules/flake/packages/pkgs/docs.nix index 019fd51b..f218a07a 100644 --- a/parts/packages/docs.nix +++ b/modules/flake/packages/pkgs/docs.nix @@ -5,12 +5,12 @@ fetchurl, simple-http-server, writeShellApplication, - ... + self, }: stdenvNoCC.mkDerivation (finalAttrs: { name = "docs"; - src = ../../docs; + src = self + /docs; nativeBuildInputs = [ mdbook diff --git a/modules/flake/packages/pkgs/lix/package.nix b/modules/flake/packages/pkgs/lix/package.nix new file mode 100644 index 00000000..6d830569 --- /dev/null +++ b/modules/flake/packages/pkgs/lix/package.nix @@ -0,0 +1,38 @@ +{ inputs', inputs }: +(inputs'.lix.packages.default.override { + # sometimes this builds from source and i hate it + # plus i don't use the features it provides so lets just disable it + aws-sdk-cpp = null; + + versionSuffix = "${inputs.lix.shortRev}-isabelroses"; +}).overrideAttrs + (oa: { + patches = [ + # adds a --call-package or -C cli option to build a package from the cli + # based on the work of https://github.com/privatevoid-net/nix-super + ./patches/lix-callpackage-cli.patch + + # add more builtins to lix, this consists of the following: + # - `builtins.abs` which will get you a absolute value of a number + ./patches/lix-feat-builtins-abs.patch + # - `builtins.greaterThan` which will return true if the first argument is greater than the second + ./patches/lix-feat-builtins-greaterThan.patch + # - `builtins.pow` which will raise the first argument to the power of the second + ./patches/lix-feat-builtins-pow.patch + ]; + + # Kinda funny right + # worth it https://akko.isabelroses.com/notice/AjlM7Vfq1zlgsEzk0G + postPatch = + (oa.postPatch or "") + + '' + substituteInPlace lix/libmain/shared.cc \ + --replace-fail "(Lix, like Nix)" "(Lix, like Nix but for lesbians)" + ''; + + # WARNING: This greatly assumes that lix will never merge a CL that breaks + # the tests. But I choose to disable them anyway because the build time is faster + # We may _also_ have to disable checks since they will fail since we cannot patch the package.nix + # to add the extra deps that are needed for the tests that i had added + doCheck = false; + }) diff --git a/parts/packages/patches/lix-callpackage-cli.patch b/modules/flake/packages/pkgs/lix/patches/lix-callpackage-cli.patch similarity index 100% rename from parts/packages/patches/lix-callpackage-cli.patch rename to modules/flake/packages/pkgs/lix/patches/lix-callpackage-cli.patch diff --git a/parts/packages/patches/lix-feat-builtins-abs.patch b/modules/flake/packages/pkgs/lix/patches/lix-feat-builtins-abs.patch similarity index 100% rename from parts/packages/patches/lix-feat-builtins-abs.patch rename to modules/flake/packages/pkgs/lix/patches/lix-feat-builtins-abs.patch diff --git a/parts/packages/patches/lix-feat-builtins-greaterThan.patch b/modules/flake/packages/pkgs/lix/patches/lix-feat-builtins-greaterThan.patch similarity index 100% rename from parts/packages/patches/lix-feat-builtins-greaterThan.patch rename to modules/flake/packages/pkgs/lix/patches/lix-feat-builtins-greaterThan.patch diff --git a/parts/packages/patches/lix-feat-builtins-pow.patch b/modules/flake/packages/pkgs/lix/patches/lix-feat-builtins-pow.patch similarity index 100% rename from parts/packages/patches/lix-feat-builtins-pow.patch rename to modules/flake/packages/pkgs/lix/patches/lix-feat-builtins-pow.patch diff --git a/parts/packages/scripts/extract.sh b/modules/flake/packages/pkgs/scripts/extract.sh similarity index 100% rename from parts/packages/scripts/extract.sh rename to modules/flake/packages/pkgs/scripts/extract.sh diff --git a/parts/packages/scripts/icat.sh b/modules/flake/packages/pkgs/scripts/icat.sh similarity index 100% rename from parts/packages/scripts/icat.sh rename to modules/flake/packages/pkgs/scripts/icat.sh diff --git a/parts/packages/scripts/package.nix b/modules/flake/packages/pkgs/scripts/package.nix similarity index 61% rename from parts/packages/scripts/package.nix rename to modules/flake/packages/pkgs/scripts/package.nix index 17e6352c..a6d368f2 100644 --- a/parts/packages/scripts/package.nix +++ b/modules/flake/packages/pkgs/scripts/package.nix @@ -1,11 +1,24 @@ -pkgs: +{ + writeShellApplication, + symlinkJoin, + bat, + eza, + catimg, + zip, + unzip, + gnutar, + p7zip, +}: let - inherit (builtins) readFile attrValues; - inherit (pkgs) writeShellApplication; + inherit (builtins) readFile; preview = writeShellApplication { name = "preview"; - runtimeInputs = attrValues { inherit (pkgs) bat eza catimg; }; + runtimeInputs = [ + bat + eza + catimg + ]; text = readFile ./preview.sh; }; @@ -17,21 +30,19 @@ let # Extract the compressed file with the correct tool based on the extension extract = writeShellApplication { name = "extract"; - runtimeInputs = attrValues { - inherit (pkgs) - zip - unzip - gnutar - p7zip - ; - }; + runtimeInputs = [ + zip + unzip + gnutar + p7zip + ]; text = readFile ./extract.sh; }; in { inherit preview icat extract; - scripts = pkgs.symlinkJoin { + scripts = symlinkJoin { name = "scripts"; paths = [ preview diff --git a/parts/packages/scripts/preview.sh b/modules/flake/packages/pkgs/scripts/preview.sh similarity index 100% rename from parts/packages/scripts/preview.sh rename to modules/flake/packages/pkgs/scripts/preview.sh diff --git a/parts/programs/default.nix b/modules/flake/programs/default.nix similarity index 100% rename from parts/programs/default.nix rename to modules/flake/programs/default.nix diff --git a/parts/programs/deploy.nix b/modules/flake/programs/deploy.nix similarity index 100% rename from parts/programs/deploy.nix rename to modules/flake/programs/deploy.nix diff --git a/parts/programs/formatter.nix b/modules/flake/programs/formatter.nix similarity index 100% rename from parts/programs/formatter.nix rename to modules/flake/programs/formatter.nix diff --git a/parts/programs/git-hooks.nix b/modules/flake/programs/git-hooks.nix similarity index 100% rename from parts/programs/git-hooks.nix rename to modules/flake/programs/git-hooks.nix diff --git a/parts/programs/shell.nix b/modules/flake/programs/shell.nix similarity index 100% rename from parts/programs/shell.nix rename to modules/flake/programs/shell.nix diff --git a/parts/programs/topology/assets/mac.png b/modules/flake/programs/topology/assets/mac.png similarity index 100% rename from parts/programs/topology/assets/mac.png rename to modules/flake/programs/topology/assets/mac.png diff --git a/parts/programs/topology/assets/pihole.png b/modules/flake/programs/topology/assets/pihole.png similarity index 100% rename from parts/programs/topology/assets/pihole.png rename to modules/flake/programs/topology/assets/pihole.png diff --git a/parts/programs/topology/assets/rpi.svg b/modules/flake/programs/topology/assets/rpi.svg similarity index 100% rename from parts/programs/topology/assets/rpi.svg rename to modules/flake/programs/topology/assets/rpi.svg diff --git a/parts/programs/topology/default.nix b/modules/flake/programs/topology/default.nix similarity index 100% rename from parts/programs/topology/default.nix rename to modules/flake/programs/topology/default.nix diff --git a/parts/programs/topology/output.nix b/modules/flake/programs/topology/output.nix similarity index 100% rename from parts/programs/topology/output.nix rename to modules/flake/programs/topology/output.nix diff --git a/parts/templates/c/.editorconfig b/modules/flake/templates/c/.editorconfig similarity index 100% rename from parts/templates/c/.editorconfig rename to modules/flake/templates/c/.editorconfig diff --git a/parts/templates/c/default.nix b/modules/flake/templates/c/default.nix similarity index 100% rename from parts/templates/c/default.nix rename to modules/flake/templates/c/default.nix diff --git a/parts/templates/c/flake.nix b/modules/flake/templates/c/flake.nix similarity index 100% rename from parts/templates/c/flake.nix rename to modules/flake/templates/c/flake.nix diff --git a/parts/templates/c/makefile b/modules/flake/templates/c/makefile similarity index 100% rename from parts/templates/c/makefile rename to modules/flake/templates/c/makefile diff --git a/parts/templates/c/shell.nix b/modules/flake/templates/c/shell.nix similarity index 100% rename from parts/templates/c/shell.nix rename to modules/flake/templates/c/shell.nix diff --git a/parts/templates/c/src/main.cpp b/modules/flake/templates/c/src/main.cpp similarity index 100% rename from parts/templates/c/src/main.cpp rename to modules/flake/templates/c/src/main.cpp diff --git a/parts/templates/default.nix b/modules/flake/templates/default.nix similarity index 100% rename from parts/templates/default.nix rename to modules/flake/templates/default.nix diff --git a/parts/templates/go/.goreleaser.yaml b/modules/flake/templates/go/.goreleaser.yaml similarity index 100% rename from parts/templates/go/.goreleaser.yaml rename to modules/flake/templates/go/.goreleaser.yaml diff --git a/parts/templates/go/default.nix b/modules/flake/templates/go/default.nix similarity index 100% rename from parts/templates/go/default.nix rename to modules/flake/templates/go/default.nix diff --git a/parts/templates/go/flake.nix b/modules/flake/templates/go/flake.nix similarity index 100% rename from parts/templates/go/flake.nix rename to modules/flake/templates/go/flake.nix diff --git a/parts/templates/go/go.mod b/modules/flake/templates/go/go.mod similarity index 100% rename from parts/templates/go/go.mod rename to modules/flake/templates/go/go.mod diff --git a/parts/templates/go/main.go b/modules/flake/templates/go/main.go similarity index 100% rename from parts/templates/go/main.go rename to modules/flake/templates/go/main.go diff --git a/parts/templates/go/shell.nix b/modules/flake/templates/go/shell.nix similarity index 100% rename from parts/templates/go/shell.nix rename to modules/flake/templates/go/shell.nix diff --git a/parts/templates/haskell/default.nix b/modules/flake/templates/haskell/default.nix similarity index 100% rename from parts/templates/haskell/default.nix rename to modules/flake/templates/haskell/default.nix diff --git a/parts/templates/haskell/flake.nix b/modules/flake/templates/haskell/flake.nix similarity index 100% rename from parts/templates/haskell/flake.nix rename to modules/flake/templates/haskell/flake.nix diff --git a/parts/templates/latex/.gitignore b/modules/flake/templates/latex/.gitignore similarity index 100% rename from parts/templates/latex/.gitignore rename to modules/flake/templates/latex/.gitignore diff --git a/parts/templates/latex/default.nix b/modules/flake/templates/latex/default.nix similarity index 100% rename from parts/templates/latex/default.nix rename to modules/flake/templates/latex/default.nix diff --git a/parts/templates/latex/flake.nix b/modules/flake/templates/latex/flake.nix similarity index 100% rename from parts/templates/latex/flake.nix rename to modules/flake/templates/latex/flake.nix diff --git a/parts/templates/latex/justfile b/modules/flake/templates/latex/justfile similarity index 100% rename from parts/templates/latex/justfile rename to modules/flake/templates/latex/justfile diff --git a/parts/templates/latex/shell.nix b/modules/flake/templates/latex/shell.nix similarity index 100% rename from parts/templates/latex/shell.nix rename to modules/flake/templates/latex/shell.nix diff --git a/parts/templates/nix/default.nix b/modules/flake/templates/nix/default.nix similarity index 100% rename from parts/templates/nix/default.nix rename to modules/flake/templates/nix/default.nix diff --git a/parts/templates/nix/flake.nix b/modules/flake/templates/nix/flake.nix similarity index 100% rename from parts/templates/nix/flake.nix rename to modules/flake/templates/nix/flake.nix diff --git a/parts/templates/nix/shell.nix b/modules/flake/templates/nix/shell.nix similarity index 100% rename from parts/templates/nix/shell.nix rename to modules/flake/templates/nix/shell.nix diff --git a/parts/templates/node/.gitignore b/modules/flake/templates/node/.gitignore similarity index 100% rename from parts/templates/node/.gitignore rename to modules/flake/templates/node/.gitignore diff --git a/parts/templates/node/default.nix b/modules/flake/templates/node/default.nix similarity index 100% rename from parts/templates/node/default.nix rename to modules/flake/templates/node/default.nix diff --git a/parts/templates/node/flake.nix b/modules/flake/templates/node/flake.nix similarity index 100% rename from parts/templates/node/flake.nix rename to modules/flake/templates/node/flake.nix diff --git a/parts/templates/node/package.json b/modules/flake/templates/node/package.json similarity index 100% rename from parts/templates/node/package.json rename to modules/flake/templates/node/package.json diff --git a/parts/templates/node/shell.nix b/modules/flake/templates/node/shell.nix similarity index 100% rename from parts/templates/node/shell.nix rename to modules/flake/templates/node/shell.nix diff --git a/parts/templates/node/src/index.ts b/modules/flake/templates/node/src/index.ts similarity index 100% rename from parts/templates/node/src/index.ts rename to modules/flake/templates/node/src/index.ts diff --git a/parts/templates/node/tsconfig.json b/modules/flake/templates/node/tsconfig.json similarity index 100% rename from parts/templates/node/tsconfig.json rename to modules/flake/templates/node/tsconfig.json diff --git a/parts/templates/python/default.nix b/modules/flake/templates/python/default.nix similarity index 100% rename from parts/templates/python/default.nix rename to modules/flake/templates/python/default.nix diff --git a/parts/templates/python/flake.nix b/modules/flake/templates/python/flake.nix similarity index 100% rename from parts/templates/python/flake.nix rename to modules/flake/templates/python/flake.nix diff --git a/parts/templates/python/shell.nix b/modules/flake/templates/python/shell.nix similarity index 100% rename from parts/templates/python/shell.nix rename to modules/flake/templates/python/shell.nix diff --git a/parts/templates/rust/Cargo.lock b/modules/flake/templates/rust/Cargo.lock similarity index 100% rename from parts/templates/rust/Cargo.lock rename to modules/flake/templates/rust/Cargo.lock diff --git a/parts/templates/rust/Cargo.toml b/modules/flake/templates/rust/Cargo.toml similarity index 100% rename from parts/templates/rust/Cargo.toml rename to modules/flake/templates/rust/Cargo.toml diff --git a/parts/templates/rust/default.nix b/modules/flake/templates/rust/default.nix similarity index 100% rename from parts/templates/rust/default.nix rename to modules/flake/templates/rust/default.nix diff --git a/parts/templates/rust/flake.nix b/modules/flake/templates/rust/flake.nix similarity index 100% rename from parts/templates/rust/flake.nix rename to modules/flake/templates/rust/flake.nix diff --git a/parts/templates/rust/shell.nix b/modules/flake/templates/rust/shell.nix similarity index 100% rename from parts/templates/rust/shell.nix rename to modules/flake/templates/rust/shell.nix diff --git a/parts/templates/rust/src/main.rs b/modules/flake/templates/rust/src/main.rs similarity index 100% rename from parts/templates/rust/src/main.rs rename to modules/flake/templates/rust/src/main.rs diff --git a/parts/checks/default.nix b/parts/checks/default.nix deleted file mode 100644 index 6c2060e3..00000000 --- a/parts/checks/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - imports = [ - ./lib.nix - ]; -} diff --git a/parts/packages/default.nix b/parts/packages/default.nix deleted file mode 100644 index 0db4c560..00000000 --- a/parts/packages/default.nix +++ /dev/null @@ -1,59 +0,0 @@ -# I would highly advise you do not use my flake as an input and instead you vendor this -# if you want to use this code, you may want to add my cachix cache to your flake -# you may want to not have to build this for yourself however -{ inputs, ... }: -{ - perSystem = - { pkgs, inputs', ... }: - { - packages = { - inherit (import ./scripts/package.nix pkgs) - scripts - preview - icat - extract - ; - - docs = pkgs.callPackage ./docs.nix { }; - - lix = - (inputs'.lix.packages.default.override { - # sometimes this builds from source and i hate it - # plus i don't use the features it provides so lets just disable it - aws-sdk-cpp = null; - - versionSuffix = "${inputs.lix.shortRev}-isabelroses"; - }).overrideAttrs - (oa: { - patches = [ - # adds a --call-package or -C cli option to build a package from the cli - # based on the work of https://github.com/privatevoid-net/nix-super - ./patches/lix-callpackage-cli.patch - - # add more builtins to lix, this consists of the following: - # - `builtins.abs` which will get you a absolute value of a number - ./patches/lix-feat-builtins-abs.patch - # - `builtins.greaterThan` which will return true if the first argument is greater than the second - ./patches/lix-feat-builtins-greaterThan.patch - # - `builtins.pow` which will raise the first argument to the power of the second - ./patches/lix-feat-builtins-pow.patch - ]; - - # Kinda funny right - # worth it https://akko.isabelroses.com/notice/AjlM7Vfq1zlgsEzk0G - postPatch = - (oa.postPatch or "") - + '' - substituteInPlace lix/libmain/shared.cc \ - --replace-fail "(Lix, like Nix)" "(Lix, like Nix but for lesbians)" - ''; - - # WARNING: This greatly assumes that lix will never merge a CL that breaks - # the tests. But I choose to disable them anyway because the build time is faster - # We may _also_ have to disable checks since they will fail since we cannot patch the package.nix - # to add the extra deps that are needed for the tests that i had added - doCheck = false; - }); - }; - }; -}