balsoft

joined 11 months ago
[–] balsoft@lemmy.ml 4 points 3 hours ago (1 children)

read a filename from the user

Honestly for something repetitive like this I'd suggest trying to avoid user interaction completely. It's probably better to get that info from the DVD drive itself (blkid -o value -s LABEL /dev/dvd), or if that fails assign a number.

[–] balsoft@lemmy.ml 6 points 1 day ago

First they came for 486, and I did not speak out - because I've never actually owned a 486...

[–] balsoft@lemmy.ml 0 points 3 days ago

UK libel laws sound way more reasonable to me. They force you to take accountability for your speech. Generally opinions and even hyperbole are fine (e.g. in this case, it's likely OK to say that you think this person is Darth Vader). But if you spout some nonsense factoid about someone, be prepared to have some proof. US could definitely use some of that (it would put a lot of right-wing media companies out of business immediately, and I'm all for it)

[–] balsoft@lemmy.ml 2 points 3 days ago* (last edited 3 days ago) (1 children)

I'm afraid it's difficult to provide a simple example as there are a bunch of moving parts.

In essence, you create a file (e.g. module.nix) in your package repo:

self:
{
  config,
  pkgs,
  lib,
  ...
}:
let
  cfg = config.programs.my-package;
in
{
  # Here we define the options that we can tweak and configure.
  options = {
    programs.my-package = {
      # Whether to configure anything in the first place
      enable = lib.mkEnableOption "my package";
      # Which colors to use
      colors =
        let
          # This is just a function to reduce boilerplates. It generates options from the name of the color setting
          color =
            name:
            lib.mkOption {
              description = "${name} color for my-package";
              type = lib.types.str;
            };
        in
        {
          bg = color "Background";
          fg = color "Foreground";
          # other colors here too
        };
    };
    # Whether to use stylix to configure colors
    stylix.targets.my-package.enable = lib.mkEnableOption "Stylix configuration for my-package";
  };
  # Here we set up our package (if programs.my-package.enable is true)
  config = lib.mkIf cfg.enable {
    # Add our package to home.packages (you're doing this already, we're just moving it here for convenience)
    home.packages = [ self.packages.${pkgs.system}.my-package ];
    # Here is the part where we do the actual configuring. This depends on how your package reads its configuration.
    xdg.configFile."my-package/colors.toml".text = ''
      <somehow generate the config file using ${cfg.bg} and ${cfg.fg} etc
    '';
    # This is a bit recursive but should be fine. If if throws errors about infinite recursion then tell me :)
    # Here we set the default values for the colors in our configuration to whatever is provided via stylix (provided you enable the corresponding config setting)
    programs = lib.mkIf stylix.targets.my-package.enable {
      my-package.colors.bg = lib.mkDefault config.stylix.colors.base00;
      my-package.colors.fg = lib.mkDefault config.stylix.colors.base05;
      # etc
    };
  };
}

Then you make sure your program reads the colors from ~/.config/my-package/colors.toml (you can use whatever format or path you want, but adjust the module accordingly), and uses those colors

Finally, you add homeModules.default = import ./module.nix self; to your package flake, and imports = [ inputs.my-package.homeModules.default ]; programs.my-package.enable = true; stylix.targets.my-package.enable = true; to your home-manager configuration. You will need to adjust a lot of stuff depending on how exactly you want to do this but this should get you started.

All of this is a bit complicated but I think for a good reason; this setup is really quite flexible and will allow you to expand easily in the future should you continue work on the project. And if not, it gives you a chance to learn about a lot of different Nix concepts that will come in useful later :)

[–] balsoft@lemmy.ml 4 points 3 days ago

Least surprising outcome

[–] balsoft@lemmy.ml 4 points 3 days ago (3 children)

I usually provide a NixOS/home-manager module together with my flake, that can then be imported and customized by setting the config options.

[–] balsoft@lemmy.ml 12 points 3 days ago (9 children)

claiming the Houthis, officially known as Ansar Allah, said they would "not be blowing up ships anymore."

Is there any confirmation from them, or is he making shit up again?

[–] balsoft@lemmy.ml 9 points 4 days ago (1 children)

* IF the EC decides to move forward with the review and IF the review recommends suspending it and IF the EU Parliament votes to suspend it; each if being significantly less likely than the previous.

[–] balsoft@lemmy.ml 13 points 4 days ago

Not even a review. It's a call for a review.

[–] balsoft@lemmy.ml 4 points 5 days ago* (last edited 5 days ago)

I would not therefore say that these countries are an example of communism

I don't think anyone is claiming that either of those countries had achieved communism. They have achieved (to varying degrees) economic socialism, i.e. public ownership of capital. If we define capitalism as a system under which capital is privately owned, then they are not "differently managed capitalism", at least if you believe that the state there has some degree of democracy and is not completely authoritarian (in which case it could be argued that it's just capitalism but with a state monopoly on every industry). The truth of course lies somewhere in between (as all of those examples have/had private ownership of capital, and are not entirely democratic), but I would say that their system seems to be generally working better for them than nearly-pure capitalism does for other countries.

[–] balsoft@lemmy.ml 7 points 5 days ago

Some really convincing evidence of mens rea for their genocide trials.

[–] balsoft@lemmy.ml 8 points 5 days ago (3 children)

Can someone explain with less legalese? In my reading, the court decided that it did not have the jurisdiction over it because... UAE decided that it didn't want the court to have jurisdiction over it? That shit would be funny if it wasn't so sad.

view more: next ›