nix shell flakes

This commit is contained in:
foglar 2025-03-14 17:04:28 +01:00
parent fde46772c8
commit 6ae3af2133
2 changed files with 71 additions and 8 deletions

View File

@ -1,20 +1,20 @@
# Nix
- [x] Own nixos ISO
- [x] Inputs in Nix
- [x] NixOS builders and writers
- [x] Nix Shell
- [x] Nix writers
- [ ] Ovverrides and overlays
- [ ] NixOS helper
- [ ] [Nixhub](https://www.nixhub.io/)
- [ ] Nix scripts
- [ ] Nix home-manager, standalone vs sysconfig module
- [ ] Plasma manager
- [ ] Stylix
- [ ] NixOS Everywhere, NixOS Anywhere
- [x] Inputs in Nix
- [ ] Nix language (if else statements, pipes, and other interesting things)
- [ ] Nix Modules
- [ ] Vlastní options
- [ ] Nix fetching
- [ ] Impermanence
- [x] Own nixos ISO
- [ ] NixOS helper
- [x] NixOS builders and writers
- [ ] Ovverrides and overlays
- [ ] Nix Shell
- [x] Nix writers
- [ ] [Nixhub](https://www.nixhub.io/)

View File

@ -180,6 +180,12 @@ nix flake show github:kamadorueda/alejandra
---
# Nová flake
* `nix flake init --template templates#full`
---
# Inputs
* `nix flake metadata --json | jq` - zobrazí vstupy
@ -228,11 +234,68 @@ nix build /etc/nixos#nixosConfigurations.nixos.config.system.build.toplevel
# Virtual machine
* `nix run github:nix-community/nixos-generators -- -c ./flake.nix --flake '#default' -f vm --disk-size 20480`
* `nixos-rebuild build-vm --flake ~/my-system-flake#default`
* možnost generovat pro různé platformy (Amazon E2C, Docker, ISO, Proxmox, VMware, vagrant, qcow, ...)
* [https://github.com/nix-community/nixos-generators](https://github.com/nix-community/nixos-generators)
---
# Nix Shell
- `nix-shell ./`
```nix
# shell.nix
{pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
packages = [
(pkgs.python311.withPackages(pypkgs: with pypkgs; [
requests
numpy
pygobject3
]))
]
}
```
---
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem
(
system: let
pkgs = import nixpkgs {
inherit system;
};
in
with pkgs; {
devShells.default = mkShell {
packages = [
(pkgs.python311.withPackages (pypkgs:
with pypkgs; [
requests
numpy
pygobject3
]))
];
};
}
);
}
```
---
# Nix language
* `nix-repl` nebo `nix-instantiate --eval foo.nix`