Add flakes and nixos stuff
This commit is contained in:
parent
9c4a775738
commit
1d48a2a77d
1 changed files with 95 additions and 0 deletions
|
|
@ -409,9 +409,104 @@ in "${pkgs.hello}"
|
||||||
Flakes
|
Flakes
|
||||||
===
|
===
|
||||||
- Experimentales
|
- Experimentales
|
||||||
|
- Pero no como piensas
|
||||||
- Simplemente un **_wrapper_** para otras configuraciones de Nix
|
- Simplemente un **_wrapper_** para otras configuraciones de Nix
|
||||||
- `flake.nix` `flake.lock`
|
- `flake.nix` `flake.lock`
|
||||||
|
|
||||||
|
```nix +line_numbers {all|2-6|6-12}
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, ... }@inputs: {
|
||||||
|
nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
./configuration.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
<!-- speaker_note: Comentar el parámetro especial self -->
|
||||||
|
<!-- end_slide -->
|
||||||
|
|
||||||
|
Configurar NixOS
|
||||||
|
===
|
||||||
|
`/etc/nixos/configuration.nix`
|
||||||
|
```nix +line_numbers {all|10|12|all}
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./hardware-configuration.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
# ......
|
||||||
|
|
||||||
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
git
|
||||||
|
vim
|
||||||
|
wget
|
||||||
|
];
|
||||||
|
environment.variables.EDITOR = "vim";
|
||||||
|
|
||||||
|
# ......
|
||||||
|
}
|
||||||
|
```
|
||||||
|
<!-- end_slide -->
|
||||||
|
|
||||||
|
Configurar NixOS con Flakes
|
||||||
|
===
|
||||||
|
`/etc/nixos/flake.nix`
|
||||||
|
```nix +line_numbers {all|11-12|all}
|
||||||
|
{
|
||||||
|
description = "A simple NixOS flake";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, ... }@inputs: {
|
||||||
|
nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
# Importamos lo que teníamos antes!
|
||||||
|
./configuration.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- speaker_note: Hablar del flake.lock que crea esto -->
|
||||||
|
|
||||||
|
<!-- end_slide -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- jump_to_middle -->
|
||||||
|
Vamos a probar algunas cosas 🙃
|
||||||
|
===
|
||||||
|
|
||||||
|
<!-- end_slide -->
|
||||||
|
Tips & tricks
|
||||||
|
===
|
||||||
|
|
||||||
|
- Si usas Git, Nix ignora todos los archivos no trackeados.
|
||||||
|
- `sudo nix-collect-garbage --delete-old`
|
||||||
|
- `sudo nix-store --optimise`
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
nix.gc = {
|
||||||
|
automatic = true;
|
||||||
|
dates = "weekly";
|
||||||
|
options = "--delete-older-than 7d";
|
||||||
|
};
|
||||||
|
|
||||||
|
nix.settings.auto-optimise-store = true;
|
||||||
|
}
|
||||||
|
```
|
||||||
<!-- end_slide -->
|
<!-- end_slide -->
|
||||||
¿Preguntas?
|
¿Preguntas?
|
||||||
===
|
===
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue