Browse Source

libkookie: introduce development shells module

main
Katharina Fey 2 weeks ago
parent
commit
8f3fdd58ce
Signed by: kookie GPG Key ID: F972AEEA2887D547
  1. 13
      apps/servers/octopus/shell.nix
  2. 2
      infra/libkookie/build
  3. 1
      infra/libkookie/configuration/nix/default.nix
  4. 3
      infra/libkookie/overlays/default.nix
  5. 29
      infra/libkookie/shells/README.md
  6. 6
      infra/libkookie/shells/base.nix
  7. 1
      infra/libkookie/shells/elixir/default.nix
  8. 4
      infra/libkookie/shells/raku/default.nix
  9. 0
      infra/libkookie/shells/rust.nix
  10. 8
      infra/libkookie/shells/rust/nightly/default.nix
  11. 7
      infra/libkookie/shells/rust/stable/default.nix
  12. 19
      nix/README.md
  13. 10
      nix/default.nix
  14. 6
      nix/raku.nix
  15. 11
      nix/rust.nix

13
apps/servers/octopus/shell.nix

@ -1,10 +1,5 @@
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "webgit";
buildInputs = with pkgs; [
rustracer rustup clangStdenv
cargo-watch openssl pkg-config
];
import <shells/rust/stable> {
userPackages = (pkgs: with pkgs; [
openssl pkg-config
]);
}

2
infra/libkookie/build

@ -21,6 +21,7 @@ function build {
-I "nixpkgs-overlays=$DIR/overlays" \
-I "home-manager=$DIR/home-manager" \
-I "modules=$DIR/modules" \
-I "shells=$DIR/shells" \
-I "configuration=$DIR/configuration" \
--out-link "$OUT" "$@"
}
@ -49,6 +50,7 @@ function vmimage {
-I "nixpkgs-overlays=$DIR/overlays" \
-I "home-manager=$DIR/home-manager" \
-I "modules=$DIR/modules" \
-I "shells=$DIR/shells" \
-I "configuration=$DIR/configuration" \
--argstr system x86_64-linux "$@"

1
infra/libkookie/configuration/nix/default.nix

@ -8,6 +8,7 @@
"home-manager=/run/current-system/libkookie/home-manager"
"nixpkgs-overlays=/run/current-system/libkookie/overlays"
"nixpkgs=/run/current-system/libkookie/nixpkgs/unstable"
"shells=/run/current-system/libkookie/shells"
];
system.extraSystemBuilderCmds = ''

3
infra/libkookie/overlays/default.nix

@ -25,3 +25,6 @@ self: super: {
iosevka = self.callPackage ./patches/iosevka { inherit (super) iosevka; };
any-nix-shell = self.callPackage ./patches/any-nix-shell { inherit (super) any-nix-shell; };
}
## Include the rust overlay
// (import ./rust self super)

29
infra/libkookie/shells/README.md

@ -0,0 +1,29 @@
# nix builders
To make development on NixOS slightly less excruciating, libkookie
ships with a set of development shells. These are environments that
can be included a by projects to provide the basic set of tools
required by a language or development framework.
libkookie itself then provides the `<shells>` key in the NIX_PATH,
which means that existing shells can easily be included and layered by
other `shell.nix` files.
## How to use
Create a `shell.nix` for a project that you want to include. The tool
`msh` (Make SHell) is available to generate these based on common
defaults. Afterwards both `lorri` and `nix-shell` will be able to
pick up the required environment for development.
```nix
{...}: import <shells/rust> {}
```
The above snippet includes the basic Rust development toolchain. You
can also provide a set of additional packages to install
```nix
{ pkgs, ... }: import <shells/rust/stable> { packages = [ pkgs.hello ]; }
```

6
infra/libkookie/shells/base.nix

@ -0,0 +1,6 @@
name: mkBuildInputs: { userPackages }:
with import <nixpkgs> {};
stdenv.mkDerivation {
inherit name;
buildInputs = (mkBuildInputs pkgs) ++ (userPackages pkgs);
}

1
infra/libkookie/shells/elixir/default.nix

@ -0,0 +1 @@
import <shells/base.nix> "elixir-dev" (pkgs: with pkgs; [ elixir ])

4
infra/libkookie/shells/raku/default.nix

@ -0,0 +1,4 @@
import <shells/base.nix> "raku-devel" (pkgs: with pkgs; [
rakudo
zef
])

0
infra/libkookie/shells/rust.nix

8
infra/libkookie/shells/rust/nightly/default.nix

@ -0,0 +1,8 @@
import <shells/base.nix> "rust-nightly" (pkgs: with pkgs; [
# Use latest nightly from overlay which has a complete toolchain
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.default))
cargo-watch
clangStdenv
rust-analyzer
])

7
infra/libkookie/shells/rust/stable/default.nix

@ -0,0 +1,7 @@
import <shells/base.nix> "rust-stable" (pkgs: with pkgs; [
rust-bin.stable.latest.default # Use latest stable from overlay
cargo-watch
clangStdenv
rust-analyzer
])

19
nix/README.md

@ -1,19 +0,0 @@
# nix builders
The kookienomicon is a collection of projects, each with their own
dependencies, and build setups. Nix and Lorri are used extentsively
to facilitate switching between build tools and dependency scopes.
The root of the repository adds a new key to the `NIX_PATH`
environment variable, which can then be used to look-up development
builders.
## How to use
There are default builders for common programming language setups
(such as Rust).
```nix
```

10
nix/default.nix

@ -1,10 +0,0 @@
/**
* Kookienomicon overlay definition
*
*
*
*/
self: super: {
}

6
nix/raku.nix

@ -1,6 +0,0 @@
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "raku-dev";
buildInputs = with pkgs; [ rakudo zef ];
}

11
nix/rust.nix

@ -1,11 +0,0 @@
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "rust-devel";
buildInputs = with pkgs; [
rust-analyzer rustc
cargo-watch
clangStdenv
hello
];
}
Loading…
Cancel
Save