1

add devshell to flake

This commit is contained in:
2022-07-29 16:26:40 +02:00
parent 8b3e975879
commit d3cbfb2417
4 changed files with 83 additions and 51 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

61
flake.lock generated
View File

@ -1,10 +1,29 @@
{
"nodes": {
"emacs-overlay": {
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1658746384,
"narHash": "sha256-CCJcoMOcXyZFrV1ag4XMTpAPjLWb4Anbv+ktXFI1ry0=",
"owner": "numtide",
"repo": "devshell",
"rev": "0ffc7937bb5e8141af03d462b468bd071eb18e1b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"emacs-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1658833746,
"narHash": "sha256-bm/FXx7lH8xaM1excP4SLexVBdaTKE5tZS8PyuibnsA=",
@ -20,6 +39,21 @@
}
},
"flake-utils": {
"locked": {
"lastModified": 1642700792,
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1656928814,
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
@ -72,7 +106,7 @@
},
"musnix": {
"inputs": {
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1628019651,
@ -89,6 +123,22 @@
}
},
"nixpkgs": {
"locked": {
"lastModified": 1643381941,
"narHash": "sha256-pHTwvnN4tTsEKkWlXQ8JMY423epos8wUOhthpwJjtpc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5efc8ca954272c4376ac929f4c5ffefcc20551d5",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 0,
"narHash": "sha256-mO+23f3SO+fBzEvbxRe6GkSB5Xp43CT2sV8Rs8MYdz8=",
@ -100,7 +150,7 @@
"type": "indirect"
}
},
"nixpkgs_2": {
"nixpkgs_3": {
"locked": {
"lastModified": 1623743177,
"narHash": "sha256-57OM8Ya/yGHAHBq/h0I8Ah/HJFmk0VNpEASYxr+BgK8=",
@ -116,7 +166,7 @@
"type": "github"
}
},
"nixpkgs_3": {
"nixpkgs_4": {
"locked": {
"lastModified": 1658737577,
"narHash": "sha256-xosJ5nJT9HX+b6UWsSX6R+ap4AdZOCrl/r+IKFp2ASQ=",
@ -149,11 +199,12 @@
},
"root": {
"inputs": {
"devshell": "devshell",
"emacs-overlay": "emacs-overlay",
"hardware": "hardware",
"home-manager": "home-manager",
"musnix": "musnix",
"nixpkgs": "nixpkgs_3",
"nixpkgs": "nixpkgs_4",
"nur": "nur"
}
},

View File

@ -20,12 +20,13 @@
nur.url = "github:nix-community/NUR";
# nixvim.url = "github:pta2002/nixvim";
musnix.url = "github:musnix/musnix";
devshell.url = "github:numtide/devshell";
};
# Outputs is a function that takes the inputs as arguments.
# To handle extra arguments we use the inputs@ pattern.
# It gives a name to the ... ellipses.
outputs = inputs@{ nixpkgs, home-manager, ... }:
outputs = inputs@{ nixpkgs, home-manager, devshell, ... }:
# With let you can define local variables
let
@ -41,10 +42,32 @@
emacs = inputs.emacs-overlay.overlay;
};
pkgs = import nixpkgs {
system = "x86_64-linux";
config.allowUnfree = true;
overlays = [ devshell.overlay ];
};
# The rec expression turns a basic set into a set where self-referencing is possible.
# It is a shorthand for recursive and allows to use the values defined in this set from its own scope.
in rec {
devShells."x86_64-linux".default = pkgs.devshell.mkShell {
name = "NixFlake Shell";
packages = with pkgs; [
jetbrains.clion
];
commands = [
{
name = "ide";
help = "Launch clion in this folder";
command = "clion ./ &>/dev/null &";
}
];
};
# System configurations + HomeManager module
# Accessible via 'nixos-rebuild'
nixosConfigurations = {
@ -60,7 +83,7 @@
# TODO: Modularize
./nixos/configuration.nix
./nixos/configuration-desktop.nix
./nixos/configuration-nixinator.nix
# TODO: Investigate this { ... } module syntax
# Overlays
@ -94,7 +117,7 @@
modules = [
# TODO: Modularize
./nixos/configuration.nix
./nixos/configuration-laptop.nix
./nixos/configuration-nixtop.nix
# TODO: Investigate this { ... } module syntax
# Overlays

View File

@ -1,43 +0,0 @@
{
description = "BSEos flake for development shell";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # For clion
overlays = [ devshell.overlay ];
};
in {
devShell = pkgs.devshell.mkShell {
name = "NixFlake";
packages = with pkgs; [
jetbrains.clion
];
commands = [
{
name = "ide";
help = "Run clion for project";
command = "clion &>/dev/null ./ &";
}
{
name = "rebuild";
help = "Build the configuration and activate the system";
command = "sudo nixos-rebuild switch --flake .#nixinator";
}
{
name = "upgrade";
help = "Upgrade the flake, rebuild the system and show diff";
command = "nix flake update && sudo nixos-rebuild build --flake .#nixinator && nvd diff /run/current-system result";
}
];
};
});
}