Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A very inmature exploration of #38 #39

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@
home.url = "github:nix-community/home-manager/release-20.09";
flake-utils.url = "github:numtide/flake-utils";
devshell.url = "github:numtide/devshell";
naersk.url = "github:nmattia/naersk";
mozilla-overlay = { url = "github:mozilla/mozilla-nixpkgs"; flake = false; };
};

outputs = inputs@{ self, home, nixos, master, flake-utils, nur, devshell }:
outputs = inputs@{ self, home, nixos, master, flake-utils, nur, devshell, naersk, mozilla-overlay }:
let
inherit (builtins) attrNames attrValues readDir elem pathExists filter;
inherit (flake-utils.lib) eachDefaultSystem mkApp;
inherit (nixos) lib;
inherit (lib) all removeSuffix recursiveUpdate genAttrs filterAttrs
mapAttrs;
inherit (utils) pathsToImportedAttrs genPkgset overlayPaths modules
genPackages pkgImport;
genPackages pkgImport devshells;

utils = import ./lib/utils.nix { inherit lib; };

system = "x86_64-linux";

externOverlays = [ nur.overlay devshell.overlay ];
externOverlays = [ nur.overlay devshell.overlay (import mozilla-overlay) naersk.overlay];
externModules = [ home.nixosModules.home-manager ];

pkgset =
Expand All @@ -45,6 +47,8 @@

nixosModules = modules;

devshellModules = devshells;

templates.flk.path = ./.;

templates.flk.description = "flk template";
Expand Down
7 changes: 7 additions & 0 deletions lib/utils.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ in
(recursiveUpdate cachixAttrs modulesAttrs)
profilesAttrs;

devshells =
let
# shells
shellList = import ../shells/list.nix;
in
pathsToImportedAttrs shellList;

genPackages = { overlay, overlays, pkgs }:
let
packages = overlay pkgs pkgs;
Expand Down
4 changes: 4 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ let
name = "flk";
in
pkgs.mkDevShell {

imports = [ (import ./shells/rust) ];
nixflk.rust.enable = true;

inherit name;

packages = with pkgs; with installPkgs; [
Expand Down
3 changes: 3 additions & 0 deletions shells/list.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
./rust
]
32 changes: 32 additions & 0 deletions shells/rust/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{ config, lib, ... }: {
options.nixflk.rust = {
enable = lib.mkEnableOption "nixflk.rust";
openssl = lib.mkEnableOption "nixflk.rust.openssl";
};
config = lib.optionalAttrs nixflk.rust.enable {
name = "Nixflk Rust DevShell";

packages = [
latest.rustChannels.stable.rust
wasm-bindgen-cli
binaryen

ncurses
pkgconfig
] ++ lib.mkIf options.nixflk.rust.openssl [
openssl
openssl.dev
];

env.RUST_BACKTRACE = "1";

commands = [
{
name = "hello";
help = "say hello";
category = "fun";
command = "echo '''hello''' ";
}
];
};
}