diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ff42b87 --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + description = "My NixOS config flake"; + + # No inputs, take this flakers + + outputs = + _: + let + sources = import ./npins; + nixpkgs = + (import sources.flake-compat { + src = sources.nixpkgs; + copySourceTreeToStore = false; + useBuiltinsFetchTree = true; + }).outputs; + inherit (nixpkgs) lib; + pkgsFor = nixpkgs.legacyPackages; + inputs = sources; + in + { + nixosConfigurations = import ./default.nix; + + packages = lib.mapAttrs (_: pkgs: { + inherit + (import ./packages { + inherit inputs pkgs sources; + }) + fish + kakoune + ; + }) pkgsFor; + devShells = lib.mapAttrs (_: pkgs: { + default = pkgs.mkShellNoCC { + packages = [ + (pkgs.callPackage (sources.npins + "/npins.nix") { }) + ]; + env.NPINS_OVERRIDE_nichts = "."; + }; + }) pkgsFor; + + templates = import ./templates; + }; +} diff --git a/hosts/hermit/configuration.nix b/hosts/hermit/configuration.nix index 7a512ae..c179d5e 100644 --- a/hosts/hermit/configuration.nix +++ b/hosts/hermit/configuration.nix @@ -44,7 +44,7 @@ owncloud.enable = true; }; hardware = { - nvidia.enable = true; + nvidia.enable = false; intel.enable = true; bluetooth = { enable = true; @@ -55,7 +55,6 @@ editors = { helix.enable = true; }; - steam.enable = true; }; sound.enable = true; }; @@ -75,6 +74,7 @@ }; programs = { ssh.enable = true; + btop.enable = true; nh.enable = true; thunar.enable = true; }; diff --git a/hosts/hermit/programs.nix b/hosts/hermit/programs.nix index ab73f78..afad470 100644 --- a/hosts/hermit/programs.nix +++ b/hosts/hermit/programs.nix @@ -14,6 +14,7 @@ calc cargo-info cbonsai + cinny-desktop cmus difftastic dua diff --git a/modules/home/dev/helix.hjem.nix b/modules/home/dev/helix.hjem.nix index 9ebe3a7..0cfd8b9 100644 --- a/modules/home/dev/helix.hjem.nix +++ b/modules/home/dev/helix.hjem.nix @@ -188,6 +188,7 @@ let rust-analyzer = { command = getExe pkgs.rust-analyzer; config.rust-analyzer = { + checkOnSave.command = "clippy"; procMacro.enable = true; cargo = { loadOutDirsFromCheck = true; diff --git a/modules/home/hjem.mod.nix b/modules/home/hjem.mod.nix index 1593737..43838e6 100644 --- a/modules/home/hjem.mod.nix +++ b/modules/home/hjem.mod.nix @@ -15,13 +15,7 @@ let in { - imports = [ - (import sources.flake-compat { - src = sources.hjem; - copySourceTreeToStore = false; - useBuiltinsFetchTree = true; - }).outputs.nixosModules.default - ]; + imports = [ (sources.hjem + "/modules/nixos") ]; config = { hjem = { diff --git a/npins/sources.json b/npins/sources.json index 8fd0d9e..bad3715 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -9,9 +9,9 @@ }, "branch": "master", "submodules": false, - "revision": "531e5219b25c1584461cc4b7fb11729a9b928b2b", - "url": "https://github.com/nix-community/comma/archive/531e5219b25c1584461cc4b7fb11729a9b928b2b.tar.gz", - "hash": "sha256-QmHTqpPugYmv7as7DqbVQLiXKdm73f0EpMg7nZvHQQQ=" + "revision": "995b210e86c9d89cdabbdee622681389ce6c95ac", + "url": "https://github.com/nix-community/comma/archive/995b210e86c9d89cdabbdee622681389ce6c95ac.tar.gz", + "hash": "sha256-dNek1a8Yt3icWc8ZpVe1NGuG+eSoTDOmAAJbkYmMocU=" }, "flake-compat": { "type": "Git", @@ -27,19 +27,6 @@ "url": "https://git.lix.systems/lix-project/flake-compat/archive/549f2762aebeff29a2e5ece7a7dc0f955281a1d1.tar.gz", "hash": "sha256-NKw96t+BgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw=" }, - "ghostty": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "ghostty-org", - "repo": "ghostty" - }, - "branch": "main", - "submodules": false, - "revision": "d3cadf24952a6088affee9f752f75c3db8287801", - "url": "https://github.com/ghostty-org/ghostty/archive/d3cadf24952a6088affee9f752f75c3db8287801.tar.gz", - "hash": "sha256-OKeY9b+enmrLNKV9J2OCWYWNDC6MZuBbObknFCK8Qfs=" - }, "hjem": { "type": "Git", "repository": { @@ -49,9 +36,9 @@ }, "branch": "main", "submodules": false, - "revision": "2426d6ad20e767895e936ed0c9563cc4e2b6c96f", - "url": "https://github.com/feel-co/hjem/archive/2426d6ad20e767895e936ed0c9563cc4e2b6c96f.tar.gz", - "hash": "sha256-WJ70Dv+tJjIl7mMOqUgcdcz+RrujDRoeKptiU6oh1lI=" + "revision": "3093a74542b30f8155954d585d0ae2401e3adbe5", + "url": "https://github.com/feel-co/hjem/archive/3093a74542b30f8155954d585d0ae2401e3adbe5.tar.gz", + "hash": "sha256-LzojKFWAAreWyH56aupj/MLwuPPnnyzplw/xdbavC9c=" }, "impermanence": { "type": "Git", @@ -75,9 +62,9 @@ }, "branch": "master", "submodules": false, - "revision": "892cbdca865d6b42f9c0d222fe309f7720259855", - "url": "https://github.com/nix-community/lanzaboote/archive/892cbdca865d6b42f9c0d222fe309f7720259855.tar.gz", - "hash": "sha256-aD6/scLN3L4ZszmNbhhd3JQ9Pzv1ScYFphz14wHinfs=" + "revision": "785a5701b22259b85735301b1aad19c2bee15498", + "url": "https://github.com/nix-community/lanzaboote/archive/785a5701b22259b85735301b1aad19c2bee15498.tar.gz", + "hash": "sha256-pZQyCkqIFwGA77np+vqVQZgg2P0qPAI6x6kC3w6+PjE=" }, "lix": { "type": "Git", @@ -89,9 +76,9 @@ }, "branch": "main", "submodules": false, - "revision": "fe6395cd4d7aa1ffd415cb2267ff431b5c66152f", - "url": "https://git.lix.systems/lix-project/lix/archive/fe6395cd4d7aa1ffd415cb2267ff431b5c66152f.tar.gz", - "hash": "sha256-AGzXkcbafClvd31K/C/Nb9MByIws+WV0lYKQ1JzvVQA=" + "revision": "321807a40e1fdd44d950ff01746c95cb6e2eced3", + "url": "https://git.lix.systems/lix-project/lix/archive/321807a40e1fdd44d950ff01746c95cb6e2eced3.tar.gz", + "hash": "sha256-2sDX5Nv/DGIzZH+3pIlAUpZfVlMGz7Hl/mqHUaic+p8=" }, "lix-module": { "type": "Git", @@ -103,9 +90,9 @@ }, "branch": "main", "submodules": false, - "revision": "1c906dd92e032bcb5a27f98cf53833cae889537f", - "url": "https://git.lix.systems/lix-project/nixos-module/archive/1c906dd92e032bcb5a27f98cf53833cae889537f.tar.gz", - "hash": "sha256-IgD1JR7scSEwlK/YAbmrcTWpAYT30LPldCUHdzXkaMs=" + "revision": "4d4c2b8f0a801c91ce5b717c77fe3a17efa1402f", + "url": "https://git.lix.systems/lix-project/nixos-module/archive/4d4c2b8f0a801c91ce5b717c77fe3a17efa1402f.tar.gz", + "hash": "sha256-gbpuESxl/An4GTh7QEbQRYJozVIxWkwVGbWK0/0GoRc=" }, "nh": { "type": "Git", @@ -116,9 +103,9 @@ }, "branch": "master", "submodules": false, - "revision": "6cd62b00023932effbf57f21879f4d2deae4b256", - "url": "https://github.com/nix-community/nh/archive/6cd62b00023932effbf57f21879f4d2deae4b256.tar.gz", - "hash": "sha256-28NHVSsYAp4vdSApAmbbdkG4bjhBODPDiyx/E4uMGpc=" + "revision": "ec34a659652d98c225e2a97d100830365d7551c3", + "url": "https://github.com/nix-community/nh/archive/ec34a659652d98c225e2a97d100830365d7551c3.tar.gz", + "hash": "sha256-+MuFPjyJl3JbNVs3Xq9dATJEbEOvwF4LMUNMmmzO7mU=" }, "nil": { "type": "Git", @@ -129,9 +116,9 @@ }, "branch": "main", "submodules": false, - "revision": "f80fe365cb441624d1608235e6e793e5dce47fb0", - "url": "https://github.com/oxalica/nil/archive/f80fe365cb441624d1608235e6e793e5dce47fb0.tar.gz", - "hash": "sha256-nFK2XhrDS5igmkDQWmyTcgiJsEr3KOcR31DaSy+Fy9s=" + "revision": "cd7a6f6d5dc58484e62a8e85677e06e47cf2bd4d", + "url": "https://github.com/oxalica/nil/archive/cd7a6f6d5dc58484e62a8e85677e06e47cf2bd4d.tar.gz", + "hash": "sha256-fK4INnIJQNAA8cyjcDRZSPleA+N/STI6I0oBDMZ2r+E=" }, "niri": { "type": "GitRelease", @@ -168,8 +155,8 @@ "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-25.11pre852965.c3e5d9f86b3f/nixexprs.tar.xz", - "hash": "sha256-izg2LuZgjCZx+B6J+lYhk1Jo4L0yAHsZTRD8vHRhD9A=" + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-25.11pre836767.e44b8dc0882d/nixexprs.tar.xz", + "hash": "sha256-euf3HhNllLzdAjWqfM+sgM8WE8H8sl7O61LpjOxsQN8=" }, "npins": { "type": "Git", @@ -180,9 +167,9 @@ }, "branch": "master", "submodules": false, - "revision": "e4683671e145c652c371b6b8ad9b0d757c88853c", - "url": "https://github.com/andir/npins/archive/e4683671e145c652c371b6b8ad9b0d757c88853c.tar.gz", - "hash": "sha256-Nu86s1xok+1EFM0J9e55hrYPgfoutEZUDBpeXReCOaY=" + "revision": "afa9fe50cb0bff9ba7e9f7796892f71722b2180d", + "url": "https://github.com/andir/npins/archive/afa9fe50cb0bff9ba7e9f7796892f71722b2180d.tar.gz", + "hash": "sha256-D6dYAMk9eYpBriE07s8Q7M3WBT7uM9pz3RKIoNk+h7I=" }, "quickshell": { "type": "Git", @@ -192,9 +179,9 @@ }, "branch": "master", "submodules": false, - "revision": "f7597cdae2d537c5b12843599955856090dc49d5", + "revision": "a5431dd02dc23d9ef1680e67777fed00fe5f7cda", "url": null, - "hash": "sha256-UkKaPXTPzT7HAcBOV4NlWx2GAEJaTf0eb5OX6Q6jPqg=" + "hash": "sha256-vqkSDvh7hWhPvNjMjEDV4KbSCv2jyl2Arh73ZXe274k=" }, "spicetify-nix": { "type": "Git", @@ -205,9 +192,9 @@ }, "branch": "master", "submodules": false, - "revision": "2bedaf52261ef2adbe71af70820aeb41dfe9a5ef", - "url": "https://github.com/Gerg-L/spicetify-nix/archive/2bedaf52261ef2adbe71af70820aeb41dfe9a5ef.tar.gz", - "hash": "sha256-lD4Zn37DWEx0X1DqM3npH68b7oh81H8BaaO3c6Ol/DQ=" + "revision": "26c488b60360e15db372483d826cec89ac532980", + "url": "https://github.com/Gerg-L/spicetify-nix/archive/26c488b60360e15db372483d826cec89ac532980.tar.gz", + "hash": "sha256-Ow+qyFckroPS4SQFHcFZ8mKh3HIQ2pQdC6DRjiYF9EE=" }, "systems": { "type": "Git", @@ -231,9 +218,9 @@ }, "branch": "main", "submodules": false, - "revision": "f68a9795616699870d213dc9e641dab655aa434a", - "url": "https://github.com/notashelf/watt/archive/f68a9795616699870d213dc9e641dab655aa434a.tar.gz", - "hash": "sha256-pETi/Fs+8FF2ZuE+JyK9+NcFaDPMHx71UdWgmzjxvkQ=" + "revision": "154724c7b1bd49654ea55df719e1eb3219ec2000", + "url": "https://github.com/notashelf/watt/archive/154724c7b1bd49654ea55df719e1eb3219ec2000.tar.gz", + "hash": "sha256-hw3rL4rlIlYJMTeE7DlQ3lRhQDJURAhE+PC/NT4VAAQ=" } }, "version": 6 diff --git a/packages/default.nix b/packages/default.nix new file mode 100644 index 0000000..bacd417 --- /dev/null +++ b/packages/default.nix @@ -0,0 +1,16 @@ +{ + inputs, + pkgs, + sources, +}: +let + inherit (pkgs) lib; + kakoune = pkgs.callPackage ./kakoune.nix { }; + fish = pkgs.callPackage ./fish { inherit lib; }; +in +{ + inherit + kakoune + fish + ; +} diff --git a/packages/fish/aliases.nix b/packages/fish/aliases.nix new file mode 100644 index 0000000..e200f6c --- /dev/null +++ b/packages/fish/aliases.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: +let + inherit (pkgs.lib) getExe; +in +{ + ls = "${getExe pkgs.eza} --icons=never"; + la = "${getExe pkgs.eza} --icons=never -lha --git"; + + g = "git"; + n = "nix"; + k = "kak"; + + c = "clear"; + cc = "cd ~ && clear"; + mv = "mv -iv"; + rm = "${pkgs.trash-cli}/bin/trash"; + lg = "${getExe pkgs.lazygit}"; + + ytopus = "yt-dlp -x --embed-metadata --audio-quality 0 --audio-format opus --embed-metadata --embed-thumbnail"; + + cat = "${getExe pkgs.bat}"; + + kys = "shutdown now"; + + cd = "z"; +} diff --git a/packages/fish/config.fish b/packages/fish/config.fish new file mode 100644 index 0000000..37afd25 --- /dev/null +++ b/packages/fish/config.fish @@ -0,0 +1 @@ +set fish_greeting diff --git a/packages/fish/default.nix b/packages/fish/default.nix new file mode 100644 index 0000000..8b09cfb --- /dev/null +++ b/packages/fish/default.nix @@ -0,0 +1,45 @@ +# This shell setup was originally inspired by sioodmy. +# Some further cool tricks, like using vendor_conf.d to avoid having +# to build fish myself, are taken from viperml's setup. +{ pkgs, ... }: +let + inherit (pkgs) lib; + inherit (lib.strings) concatStringsSep; + inherit (lib.attrsets) mapAttrsToList; + + toml = pkgs.formats.toml { }; + starship-config = import ./starship.nix; + aliases = import ./aliases.nix { inherit pkgs; }; + vendorConf = "share/fish/vendor_conf.d"; + + fishinit = import ./fishinit.nix { + inherit + pkgs + aliasesStr + vendorConf + ; + }; + + aliasesStr = mapAttrsToList (k: v: "alias ${k}=\"${v}\"") aliases |> concatStringsSep "\n"; + + packages = import ./packages.nix pkgs; +in +(pkgs.symlinkJoin { + name = "fish"; + paths = [ pkgs.fish ] ++ packages; + nativeBuildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/fish \ + --set STARSHIP_CONFIG "${toml.generate "starship.toml" starship-config}" \ + --prefix XDG_DATA_DIRS : "${ + lib.makeSearchPathOutput "out" "share" [ + fishinit + ] + }" + ''; +}).overrideAttrs + (_: { + passthru = { + shellPath = "/bin/fish"; + }; + }) diff --git a/packages/fish/fishinit.nix b/packages/fish/fishinit.nix new file mode 100644 index 0000000..b818cce --- /dev/null +++ b/packages/fish/fishinit.nix @@ -0,0 +1,34 @@ +{ + pkgs, + aliasesStr, + vendorConf, +}: +pkgs.writeTextDir "${vendorConf}/blox_config.fish" + # fish + '' + # source ${pkgs.fishPlugins.sponge}/share/zsh-defer/zsh-defer.plugin.zsh + ${pkgs.atuin}/bin/atuin init fish | source + bind up _atuin_bind_up + + ${pkgs.zoxide}/bin/zoxide init fish | source + # abbr --erase cd &>/dev/null + # alias cd=__zoxide_z + + # abbr --erase ci &>/dev/null + # alias ci=__zoxide_zi + + + ${pkgs.starship}/bin/starship init fish | source + ${pkgs.direnv}/bin/direnv hook fish | source + ${pkgs.pay-respects}/bin/pay-respects fish --alias f --nocnf | source + + # I need to source /etc/profile using foreign-env, to get stuff set by nixos, e.g. environment.systemVariables. + # set -p fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d + + # fenv source /etc/profile + + source ${./config.fish} + + + ${aliasesStr} + '' diff --git a/packages/fish/packages.nix b/packages/fish/packages.nix new file mode 100644 index 0000000..3a3aacb --- /dev/null +++ b/packages/fish/packages.nix @@ -0,0 +1,67 @@ +pkgs: +builtins.attrValues { + inherit (pkgs) + # better cd + zoxide + # pipe viewer + pv + # hex editor + bvi + #better ls + eza + atuin + # better cat + bat + # clipboard + # yazi + serpl + diff-so-fancy + tig + direnv + sesh + mprocs + curlie + entr + procs + sd + # mult + glow + # dua-cli + dust + kondo + # better grep + ripgrep + # IP stuff + dig + # simply the best fetch tool out there + microfetch + fzf + element + difftastic + hexyl + yazi + gnumake + asciinema + inetutils + tokei + starship + wget + cpufetch + watchman + # yt-dlp # borked check phase + tealdeer + hyperfine + imagemagick + ffmpeg-full + # catimg + timg + nmap + fd + jq + rsync + figlet + unzip + zip + trash-cli + ; +} diff --git a/packages/fish/starship.nix b/packages/fish/starship.nix new file mode 100644 index 0000000..dec32be --- /dev/null +++ b/packages/fish/starship.nix @@ -0,0 +1,123 @@ +{ + add_newline = false; + aws.symbol = " "; + buf.symbol = " "; + bun.symbol = " "; + c.symbol = " "; + cmake.symbol = " "; + conda.symbol = " "; + cpp.symbol = " "; + crystal.symbol = " "; + dart.symbol = " "; + deno.symbol = " "; + directory.read_only = " 󰌾"; + docker_context.symbol = " "; + elixir.symbol = " "; + elm.symbol = " "; + fennel = { + symbol = " "; + }; + fossil_branch = { + symbol = " "; + }; + gcloud = { + symbol = " "; + }; + git_branch = { + symbol = " "; + }; + git_commit = { + tag_symbol = "  "; + }; + golang.symbol = " "; + gradle = { + symbol = " "; + }; + guix_shell = { + symbol = " "; + }; + haskell = { + symbol = " "; + }; + haxe = { + symbol = " "; + }; + hg_branch = { + symbol = " "; + }; + hostname = { + ssh_symbol = " "; + }; + java = { + symbol = " "; + }; + julia = { + symbol = " "; + }; + kotlin = { + symbol = " "; + }; + lua = { + symbol = " "; + }; + memory_usage = { + symbol = "󰍛 "; + }; + meson = { + symbol = "󰔷 "; + }; + nim = { + symbol = "󰆥 "; + }; + nix_shell = { + symbol = " "; + }; + nodejs = { + symbol = " "; + }; + ocaml = { + symbol = " "; + }; + os = { + symbols = { + Linux = " "; + NixOS = " "; + }; + }; + package = { + symbol = "󰏗 "; + }; + perl = { + symbol = " "; + }; + php = { + symbol = " "; + }; + pijul_channel = { + symbol = " "; + }; + pixi = { + symbol = "󰏗 "; + }; + python = { + symbol = " "; + }; + rlang = { + symbol = "󰟔 "; + }; + ruby = { + symbol = " "; + }; + rust = { + symbol = "󱘗 "; + }; + scala = { + symbol = " "; + }; + swift = { + symbol = " "; + }; + zig = { + symbol = " "; + }; +} diff --git a/packages/kakoune.nix b/packages/kakoune.nix new file mode 100644 index 0000000..73fde0b --- /dev/null +++ b/packages/kakoune.nix @@ -0,0 +1,69 @@ +{ + fetchFromGitHub, + makeWrapper, + stdenv, + symlinkJoin, + kakounePlugins, + ... +}: +let + custom-kakoune = stdenv.mkDerivation { + name = "custom-kakoune"; + src = fetchFromGitHub { + owner = "mawww"; + repo = "kakoune"; + rev = "da5e5bc635fa6a3def21d3d59906b9ee0f1d1831"; + hash = "sha256-+xqJrJr6nnmEpQaizQ3JMDEISCD8IMB84NJZiXJ74kY="; + }; + + makeFlags = [ + "debug=no" + "PREFIX=${placeholder "out"}" + ]; + + enableParallellBuilding = true; + + doInstallCheck = false; + installCheckPhase = '' + $out/bin/kak -ui json -e "kill 0" + ''; + postInstall = '' + cd "$out/share/kak" + autoload_target=$(readlink autoload) + rm autoload + mkdir autoload + ln -s --relative "$autoload_target" autoload + ''; + }; + plugins = builtins.attrValues { + inherit (kakounePlugins) ; + }; + + kakoune-wrapped = symlinkJoin { + name = "kakoune-wrapped"; + nativeBuildInputs = [ makeWrapper ]; + paths = [ custom-kakoune ] ++ plugins; + + postBuild = '' + # create a directory for bins that kakoune needs + # access to, without polluting the users path by adding + # that binary nested with this symlinkJoin. + mkdir -p $out/share/kak/bin + + # location of kak binary is used to find ../share/kak/autoload, + # unless explicitly overriden with KAKOUNE_RUNTIME + rm "$out/bin/kak" + makeWrapper "${custom-kakoune}/bin/kak" "$out/bin/kak" \ + --set KAKOUNE_RUNTIME "$out/share/kak" \ + --suffix PATH : "$out/share/kak/bin" + + # currently kakoune ignores doc files if they are symlinks, so workaround by + # copying doc files over, so they become regular files... + mkdir "$out/DELETE_ME" + mv "$out/share/kak/doc" "$out/DELETE_ME" + cp -r --dereference "$out/DELETE_ME/doc" "$out/share/kak" + rm -Rf "$out/DELETE_ME" + ''; + }; +in +kakoune-wrapped diff --git a/templates/default.nix b/templates/default.nix new file mode 100644 index 0000000..0dea28b --- /dev/null +++ b/templates/default.nix @@ -0,0 +1,6 @@ +{ + rust = { + path = ./rust; + description = "Rust project template"; + }; +} diff --git a/templates/rust/.envrc b/templates/rust/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/templates/rust/.envrc @@ -0,0 +1 @@ +use flake diff --git a/templates/rust/Cargo.toml b/templates/rust/Cargo.toml new file mode 100644 index 0000000..892d1eb --- /dev/null +++ b/templates/rust/Cargo.toml @@ -0,0 +1,5 @@ +[package] +name = "sample-rust" +version = "0.0.1" +license = "GPL-3.0-only" +edition = "2024" diff --git a/templates/rust/default.nix b/templates/rust/default.nix new file mode 100644 index 0000000..3d6c889 --- /dev/null +++ b/templates/rust/default.nix @@ -0,0 +1,8 @@ +{ rustPlatform }: +rustPlatform.buildRustPackage { + pname = "some-rust-package"; + version = "0.0.1"; + + src = ./.; + cargoLock.lockFile = ./Cargo.lock; +} diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix new file mode 100644 index 0000000..2bc9461 --- /dev/null +++ b/templates/rust/flake.nix @@ -0,0 +1,36 @@ +{ + description = "Rust project template"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + systems.url = "github:nix-systems/default-linux"; + }; + + outputs = + inputs: + let + inherit (inputs.nixpkgs) lib; + inherit (lib.attrsets) genAttrs mapAttrs; + + eachSystem = genAttrs (import inputs.systems); + pkgsFor = inputs.nixpkgs.legacyPackages; + in + { + packages = eachSystem (system: { + default = inputs.self.packages.${system}.ralc; + ralc = pkgsFor.${system}.callPackage ./nix/package.nix { }; + }); + + devShells = mapAttrs (_: pkgs: { + default = pkgs.mkShell { + packages = with pkgs; [ + cargo + rustc + rustfmt + bacon + rust-analyzer + rustPackages.clippy + ]; + }; + }) pkgsFor; + }; +} diff --git a/templates/rust/src/main.rs b/templates/rust/src/main.rs new file mode 100644 index 0000000..47ad8c6 --- /dev/null +++ b/templates/rust/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World!"); +}