Skip to content

Commit

Permalink
Merge pull request #54 from nrdxp/devshell
Browse files Browse the repository at this point in the history
Use mkDevShell for shell.nix
  • Loading branch information
nrdxp authored Dec 29, 2020
2 parents 828a939 + 893e092 commit 165ffaa
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 32 deletions.
17 changes: 17 additions & 0 deletions compat/fetch.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let
inherit (builtins)
fetchTarball
fromJSON
readFile
;
lockfile = fromJSON (readFile ../flake.lock);
in
input:
let
locked = lockfile.nodes."${input}".locked;
inherit (locked) rev narHash owner repo;
in
fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
sha256 = narHash;
}
5 changes: 5 additions & 0 deletions compat/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let
fetch = import ./fetch.nix;
nixpkgs = fetch "nixos";
in
nixpkgs
16 changes: 16 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
nixos.url = "nixpkgs/release-20.09";
home.url = "github:nix-community/home-manager/release-20.09";
flake-utils.url = "github:numtide/flake-utils";
devshell.url = "github:numtide/devshell";
};

outputs = inputs@{ self, home, nixos, master, flake-utils, nur }:
outputs = inputs@{ self, home, nixos, master, flake-utils, nur, devshell }:
let
inherit (builtins) attrNames attrValues readDir elem pathExists filter;
inherit (flake-utils.lib) eachDefaultSystem mkApp;
Expand All @@ -23,7 +24,7 @@

system = "x86_64-linux";

externOverlays = [ nur.overlay ];
externOverlays = [ nur.overlay devshell.overlay ];
externModules = [ home.nixosModules.home-manager ];

pkgset =
Expand Down Expand Up @@ -57,7 +58,7 @@
pkgs' = pkgImport {
pkgs = master;
system = system';
overlays = [ ];
overlays = [ devshell.overlay ];
};

packages' = genPackages {
Expand All @@ -79,7 +80,6 @@
{
devShell = import ./shell.nix {
pkgs = pkgs';
nixpkgs = nixos;
};

apps =
Expand Down
13 changes: 0 additions & 13 deletions nixpkgs-compat.nix

This file was deleted.

1 change: 1 addition & 0 deletions profiles/develop/zsh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ in
systemPackages = with pkgs; [
bat
bzip2
devshell
exa
gitAndTools.hub
gzip
Expand Down
32 changes: 17 additions & 15 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
let
nixpkgs' = import ./nixpkgs-compat.nix;
nixpkgs = import ./compat/nixpkgs.nix;
fetch = import ./compat/fetch.nix;

devshell' = fetch "devshell";
pkgs' = import devshell' { inherit nixpkgs; };
in
{ pkgs ? import nixpkgs { }, nixpkgs ? nixpkgs' }:
{ pkgs ? pkgs', ... }:
let
configs = "${toString ./.}#nixosConfigurations";
build = "config.system.build";
Expand All @@ -22,29 +26,27 @@ let
sudo nixos-rebuild --flake ".#$1" $@
fi
'';

nix = pkgs.writeShellScriptBin "nix" ''
${pkgs.nixFlakes}/bin/nix --option experimental-features "nix-command flakes ca-references" "$@"
'';
in
pkgs.mkShell {
pkgs.mkDevShell {
name = "nixflk";
nativeBuildInputs = with pkgs; with installPkgs; [

packages = with pkgs; with installPkgs; [
git
git-crypt
flk
nix-zsh-completions
nix
nixpkgs-fmt
python38Packages.grip
nixos-install
nixos-generate-config
nixos-enter
nixos-rebuild
];

shellHook = ''
mkdir -p secrets
if ! nix flake show &> /dev/null; then
PATH=${
pkgs.writeShellScriptBin "nix" ''
${pkgs.nixFlakes}/bin/nix --option experimental-features "nix-command flakes ca-references" "$@"
''
}/bin:$PATH
fi
'';
env = { };

}

0 comments on commit 165ffaa

Please sign in to comment.