Skip Navigation
Printing on Linux
  • It used to back in the day, especially if you tried using shitty windows usb inkjets.

    Nowadays basically all printers are network printers (they are, aren't they?) plus we have cups which is the same thing macos uses (so manufacturers actually care).

  • My experience with microsoft's ads for linux.
  • Agreed. I don't come here to read about windows.

    Also, "microsoft's ads for linux" in the title is a fraud clickbait.

  • is there any way to increase the size of my /var directory under debian 12.7? (flatpak related)
  • (I assume you meant "I created a separated /var partition")

    You can move/resize partitions from basically any live usb (via cli or gparted for gnome and kde partition manager for kde).

    Shall you want to, you can also merge the var partition with (say) your root partition:

    1. mount both partitions in two directories (just create empty ones and mount on them, say ~/root and ~/var)
    2. inside ~/root create the new var/ directory
    3. copy the data over
    4. edit ~/root/etc/fstab (remove the live for the old var partition)
    5. use whatever partitioning tool to get rid of the actual partition and expand the previous/next one

    Be aware that you can very easily lose your data ;)

    PS: just in case, try running flatpak uninstall --unused

  • Cron Jobs on Linux - Comprehensive Guide with Examples
  • You can use OnFailure in your .service file if you want some thing to happen when that specific service fails, but I don't know if there's a blanket way to tell systemd to notify via email when any failure happens (I wouldn't mind a desktop notification... will investigate)

  • [newbie] one-liner to avoid "temporary value dropped while borrowed"?

    (I'm just starting off with rust, so please be patient)

    Is there an idiomatic way of writing the following as a one-liner, somehow informing rustc that it should keep the PathBuf around?

    ```rust // nevermind the fully-qualified names // they are there to clarify the code // (that's what I hope at least)

    let dir: std::path::PathBuf = std::env::current_dir().unwrap(); let dir: &std::path::Path = dir.as_path();

    // this won't do: // let dir = std::env::current_dir().unwrap().as_path(); ``` I do understand why rust complains that "temporary value dropped while borrowed" (I mean, the message says it all), but, since I don't really need the PathBuf for anything else, I was wondering if there's an idiomatic to tell rust that it should extend its life until the end of the code block.

    10
    Cron Jobs on Linux - Comprehensive Guide with Examples
  • I'd recommend learning/using systemd timers instead (well, if you are on inux and your distro uses systems)

  • I'm thinking of building a PC - any advice?
  • ebay, ebay, ebay (and also pcpartpicker).

    Unless you want to frag people at 4k@140Hz in the latest AAA game, you probably don't need the latest generation components (and I'd say your requirement are quite low here, consider how the only thing you complain about is storage space).

    Unless you really want to assemble everything by yourself, consider buying one of the second-hand, previous-gen gaming rigs on ebay (but watch out for scams!). Even if you do want to assemble the PC yourself, consider buying used parts on ebay (or buying a full PC to cannibalize reselling the excess).

    What are the specs of your current rig? Except for storage, are you satisfied with how it runs? How much storage do you need for the projects you are working on? How much to archive things? Do you want to do anything about backups? Is a full size tower ok? How good a video do you want? What is your budget?

  • Is the Gecko engine the only reason Mozilla still exists?
  • Well... I'd rather say It's the only reason why we still care about Mozilla and put up with their crap :)

  • can I opt out of credit agencies?
  • It's quite easy to get rid of all that crap: just come living in the EU

  • Ford Chairman & CEO Jim Farley Wakes After Decade-long Nap, Shocked By China's EVs - CleanTechnica
  • The problem with Chinese EVs is that they show it’s possible to innovate, keep prices down, and mass produce.

    It's not only possible, it's easy: you just need terrible labor and environmental standards, poor welfare, cheap access to raw materials, and tons of state subsidies :)

    It's interesting to note that "we" knew all along it would end like this but just couldn't resist moving/outsourcing production to China nor investing in China's fast-growing economy.

    "We" were chasing short-term profits and China was playing the long game. Apparently, both parties won, each at their own game.

    Stop making $70K SUVs and start making $20K Taurus and Escort EVs. You did it once. You can do it again.

    The cost of batteries is (relatively) higher for cheap vehicles, so that's the segment where it makes the most difference.

  • Linus Torvalds: Speaks on the Rust vs C Linux Divide
  • I took notes for the benefit of anyone who doesn’t like their info in video form.

    I love you.

  • Apple AirTag alternatives for theft prevention?
  • Kensington? I don't think an air tag can actually prevent theft (if they see it they'll remove it - if they don't see it they'll still steal your stuff)

  • Is there a Windows 10 inspired launch menu?
  • But it has no ads

  • Can I do this in hyprland? In sway? In any other WM?
  • Reading https://codeberg.org/river/river/src/branch/master/protocol/river-layout-v3.xml it seems to me that what I want to do is actually not possible in river, even writing a custom layout manager...

    IIUC the protocol works like this: river asks "how should I layout N windows in HxW screen?" and the layout replies "window1: H1xW1 at offset X1,Y1; window2: H2xW2 ...", so there is no way for the layout manager to identify specific windows and, in my use case, put all the text editors on the left side of the screen etc.

    Did you have some other approach in mind when you suggested river? (I may very well be over-complicating things and not seeing a more straightforward solution)

  • Learn Git Branching
  • That, or git log --graph --pretty=oneline

    (IDK why people seem to be willing to recommend using anything in order to learn git, with the exception of git itself)

  • Can I do this in hyprland? In sway? In any other WM?
  • TBH I really liked the idea behind river, but does it have tabs? Also... I would need to write my own custom layout, wouldn't I?

    BTW: are there other WMs that are modular like river?

  • Can I do this in hyprland? In sway? In any other WM?
  • Sorry to be a bother, but... how do I tell hyprland I want a window to be added to a specific group?

    I was thinking of something like:

    windowrulev2 = tag texteditor, class:(myfirsteditor)
    windowrulev2 = tag texteditor, class:(mysecondeditor)
    windowrulev2 = group XXX, tag:texteditor
    

    but I can't find what I should write instead of group XXX to tell hyprland/hy3 that I want the window to be added to a group on the left-side of workspace 1...

    I would also be fine with some rule that could be added to exec or probably even some dispatcher, but I can't find anything that allows to target (or define) a specific group.

    Am I pursuing this from the wrong direction?

  • Can I do this in hyprland? In sway? In any other WM?

    I want to have my screen (the "dev" workspace) split in three "zones":

    • on the left side, a tabbed group with all the text editors I start (ie. if I start a new one, it goes there in a new tab)
    • on the top-right, a tabbed group of whatever many terminal I feel like launching
    • on the bottom-right, my browsers (and possibly other stuff), in a group without tabs
    • a key combination to cycle between: all three "zones" visible, text editors on the left - terminal on the right, text editors on the left - browser on the right, fullscreen browser

    So far I've been looking at hyprland (for no particular reason except the hype) and I don't think I can do the above with it (I am by no means an expert, so... maybe it can actually be done?).

    Do you know of any WM where it would be possible? (possibly, one with automatic splitting a-la bspwm, that I would use for the other workspaces)

    7
    New terminal apps: Warp and Wave
  • Philosophy aside, the practical issue with your terminal emulator having to support your shell is... that one does not use just one shell: what happens whenever you start a repl or an whatever program that has interactive sessions (say, for example, psql or parted)?

    tightly integrated shell and terminal emulator support. There are just things you cannot do with these being separate things.

    I can't think of any, but I'm not the most creative person... what do you have in mind?

    Having something that is like (say) tmux+fish could make sense, but only if it's something that outweighs the lost flexibility of being able to combine <whatever shell you like> + <whatever terminal multiplexer you fancy>.

  • New terminal apps: Warp and Wave
  • Might I add the idea that your terminal emulator must support your shell is utterly ridiculous?

    https://docs.waveterm.dev/reference/faq#what-shells-does-wave-terminal-support

    https://docs.warp.dev/getting-started/using-warp-with-shells

    Also Wave might be FOSS but if you look at the footer in their website it says it's backed by venture capital... how would you estimate the chances it gets closed, paywalled or otherwise enshittified?

  • New terminal apps: Warp and Wave
  • That's not something a terminal emulator should do - it's a feature that belongs in your shell :)

  • Recommend me a scripting language

    I've been looking around for a scripting language that:

    • has a cli interpreter
    • is a "general purpose" language (yes, awk is touring complete but no way I'm using that except for manipulating text)
    • allows to write in a functional style (ie. it has functions like map, fold, etc and allows to pass functions around as arguments)
    • has a small disk footprint
    • has decent documentation (doesn't need to be great: I can figure out most things, but I don't want to have to look at the interpter source code to do so)
    • has a simple/straightforward setup (ideally, it should be a single executable that I can just copy to a remote system, use to run a script and then delete)

    Do you know of something that would fit the bill?

    ---

    Here's a use case (the one I run into today, but this is a recurring thing for me).

    For my homelab I need (well, want) to generate a luhn mod n check digit (it's for my provisioning scripts to generate synchting device ids from their certificates).

    I couldn't find ready-made utilities for this and I might actually need might a variation of the "official" algorithm (IIUC syncthing had a bug in their initial implementation and decided to run with it).

    I don't have python (or even bash) available in all my systems, and so my goto language for script is usually sh (yes, posix sh), which in all honestly is quite frustrating for manipulating data.

    111
    Mozilla acquired Anonym, an ad start-up
    blog.mozilla.org Mozilla Welcomes Anonym: Privacy Preserving Digital Advertising | The Mozilla Blog

    Mozilla has acquired Anonym, a trailblazer in privacy-preserving digital advertising. This strategic acquisition enables Mozilla to help raise the bar for

    Mozilla Welcomes Anonym: Privacy Preserving Digital Advertising | The Mozilla Blog
    38
    Launcher with integrated clock and tray?

    After years of my desktop environment (kde) being configured the same way, I tried enabling auto-hiding in my panel and I quite like the extra screen estate.

    Now, the only reasons why I have a panel in the first place are the clock and the system tray (I don't use the start applications menu and I don't care for the task manager) so I've started wondering if I could completely dispose of the panel.

    Do you know of any launcher (I use krunner but switching to something else is fine) that satisfies (or can be configured to satisfy) the following?

    1. shows the current date/time
    2. integrates a system tray
    3. launches applications
    4. does math, unit conversion and currency conversion
    7
    What depends on a specific package?

    While updating home-manager I got a notice that freeimage-unstable-2021-11-01 is marked as unsafe.

    Since chances are it's used by something I never use, I'd like to know what I'm using that depends on it... any idea how to do it?

    Also.. any idea why I have 4 copies of the freeimage stuff in my /nix/store? (I just run nix-collect-garbage -d and the 4 seem to be actually different):

    ❱ md5sum /nix/store/*freeimage*/lib/libfreeimage.a 67a0ce1cb5dd562473e27d7c88e8a9bd /nix/store/6gi6hm57zngqnxb6p5dnxhjjcbr96lrk-freeimage-unstable-2021-11-01/lib/libfreeimage.a 5995e0affbfa28b63da7e997cb4dbe63 /nix/store/09nwykzzksc0zknflsyxyah5b67c2rsn-freeimage-unstable-2021-11-01/lib/libfreeimage.a 67a0ce1cb5dd562473e27d7c88e8a9bd /nix/store/ikfiv4gpmcpyir7lsj45by653qcnvgyx-freeimage-unstable-2021-11-01/lib/libfreeimage.a 213a408e3c1fbb5dfa4491deebe05984 /nix/store/q2sc85f2hclgwl8m3qdw8rpbs44gzmah-freeimage-unstable-2021-11-01/lib/libfreeimage.a

    6
    Looking for FOSS android TV (or something like Kodi, but dumber)

    I've been looking for something to replace the google chromecast that is attached to our TV.

    I've tried Kodi out, but the main use case for the TV set is a 70+ yo person watching netflix and there is just no way they will be better off with Kodi than with the stock netflix app.

    Besides supporting netflix, being easy to use, and providing significantly better privacy than the chromecast does, the device would ideally:

    • support other mainstream streaming (amazon, disney, ...) for when my people get tired of netflix
    • support a DVB-T2 usb stick (directly, or through IPTV: I can put the stick in a different machine)
    • support youtube without ads (through an adblocker and possibly sponsorblock, or maybe using invidious)
    • possibly, support local public TV streaming (eg. BBC)

    I have a PC set aside that should be more than capable enough (intel N100), but I'm open to getting new hardware if needed. Also, it doesn't matter if the system is not very user friendly to setup (eg. if it needs to be nixos), but once it's setup it should be easy to use and relatively straightforward to update/maintain.

    I guess a FOSS android TV would be ideal, but.. is there any? (I see Lineage supports the Google ADT-3, but that is basically unobtanium, at least where I live).

    45
    Recommendations for workout/training tracker app?

    The app at my gym sucks: there is no checklist of what exercises you have done and no tracking of how much weight you used. Plus, for whatever reason, it wants access to my location.

    I've found a number of alternatives on F-Droid, but each of the six or so I tried was completely unusable (some seemed unfinished alphas, others are probably too old for my android version).

    Is there one app that you use and would recommend?

    What I'm looking for is:

    • At home: I setup my programs (different ones for different days)
    • At the gym: I can select a program, check off the exercises while I do them (the order I do them on depends on where there is fewer people at the gym), and log things like if I managed all the sets/reps, how much weight I used, and how long I exercised for (for things like the tapis roulant).
    • Bonus points if I can also track my weight in the same app, and if the app can export/sync the data or produce some kind of graphs/statistics based on it.

    Thanks!

    4
    ANC headphones/earbuds that require no proprietary apps?

    This may be OT since strictly speaking it's about hardware... I trust it is ok to post it given the spirit of the community, but have my apologies and feel free to remove it if it's not.

    I'm looking to replace my old Bose QC25, since they have recently died (after a long a fulfilling life), but it seems everything nowadays is bluetooth (which I don't mind) and require some proprietary app to turn ANC on/off (which I do mind... are physical buttons/switches become too expensive to include in your overpriced earbuds?).

    Anyway... do you know of any headphones/earbuds that meet the following?

    1. can be powered via wire or have batteries that last 12+hrs (long-haul flights)
    2. have decent noise cancelling
    3. don't require me to install a apps or can be used with some open source app (possibly with full functionality and straightforward to setup)
    4. are not overly expensive (I have to buy 2 pairs and I'll only use them a few times a year when I fly)
    41
    nixos @lemmy.ml gomp @lemmy.ml
    How can I reference the `escapeSystemdPath` function (from nixpkgs' `nixos/lib/utils.nix`) in my config?

    I want to call the escapeSystemdPath (defined in nixpgs at nixos/lib/utils.nix) to derive the name of a systemd mount unit from the target path (eg. srv-my-dir.mount from /srv/my/dir), but I can't figure out how I can reference it... any ideas?

    2
    nixos @lemmy.ml gomp @lemmy.ml
    Who's setting up swap for me?

    I'm playing around with nixos in a few VMs and at some point I realized I must have lost the swap configuration in one of my refactorings.

    To my surprise, however, the VMs do use the swap partitions I had set up.

    There is no mention on "swap" in my nix configuration (or in fstab) and no .swap units in /etc/systemd/system; I do however have a swap partition labelled "swap".

    Turns out there is a systemd unit (albeit not a corresponding file) that sets up swap:

    ``` [root@vm1:~]# free -hw total used free shared buffers cache available Mem: 2.8Gi 664Mi 955Mi 4.0Mi 3.0Mi 1.3Gi 2.0Gi Swap: 3.7Gi 0B 3.7Gi

    [root@vm1:~]# systemctl list-dependencies swap.target swap.target ● └─dev-disk-by\x2ddiskseq-1\x2dpart3.swap ```

    I'm wondering where the unit comes from? Can I rely on this and never configure swap ever again?

    2
    Any extension to deal with AI-generated articles?

    Is there an extension that warns you when you are wasting time reading ai-generated crap?

    Case in point, I was reading an article that claimed to compare kubernetes distros and wasted some good minutes before realizing it was full of crap.

    23
    nixos @lemmy.ml gomp @lemmy.ml
    Defining an option that can only be set in certain circumstances

    I have an option that must be left with the default value when a certain flag (another option) is false.

    I didn't find any example (let alone documentation) on how to implement this, so I've come up with two ideas:

    nix option-that-errors-out-if-set-when-flag-is-false = let default = if config.some-flag then "some default value for when flag is true" else "value that should not be changed when flag is false"; in lib.mkOption { type = lib.types.str; inherit default; apply = v: assert assertMsg (config.some-flag || v == default) "Do not set this option unless 'flag' is true"; v; };

    nix option-that-ignores-value-when-flag-is-false = let default = if config.some-flag then "some default value for when flag is true" else "value that should not be changed when flag is false"; in lib.mkOption { type = lib.types.str; inherit default; apply = v: if config.some-flag then v else default; };

    Which one do you think is "best" (cleaner, more idiomatic, etc..)?

    Is apply the "right" place to validate options? Should I make a custom type instead? Should I approach this in some different way?

    0
    nixos @lemmy.ml gomp @lemmy.ml
    Setting "global" options from a submodule?

    I'd like to set a "global" option from within a submodule, but the config I return is grafted into the "global" under the submodule "path" rather than at the root... any idea if it's somehow possible?

    Er... I guess I didn't make a great job at explaining what I want to do... Some code will hopefully help.

    In mymodule.nix I have: ```` { lib, config, ... }: {

    options.myoption = lib.mkOption { type = lib.types.attrsOf (lib.types.submodule ( import ./mysubmodule.nix )); };

    } and `mysubmodule.nix` is: { name, lib, config, ... }: {

    options.mysubmoduleoption = { type = lib.types.str; };

    config = {

    here I want to set a "global" option, say "systemd.mounts"

    based on the value of "mymodule.name.mysubmoduleoption"

    but it seems I can only set values under "mymodule.name"

    };

    } ````

    4
    nixos @lemmy.ml gomp @lemmy.ml
    Help with `builtins.trace`

    I'm trying to debug a module I'm writing with builtins.trace, but it's being more complicated than I anticipated.

    Let's say I have a module:

    ````nix { config, lib, pkgs, modulesPath, ... }:

    {

    config = let some-list = lib.attrsets.mapAttrsToList (n: v: { some-attr = "${n} ${v}"; }) { n1 = "v1"; n2 = "v2"; }; in { users.mutableUsers = builtins.trace (some-list) false; };

    } ````

    This will print

    trace: [ <code> <code> ]

    because builtins.trace (for whatever reason?) evaluates its first argument only shallowly.

    Changing the trace expression to:

    builtins.trace (builtins.toJSON some-list) false; helps a lot, but as soon as one tries to print a long list or a structure with some complexity the output is completely unreadable, and it's not like it can easily be piped into jq (I mean... &amp;| grep ^trace: | sed 's/trace: //' | jq works\*, but there must be a "better" way?)

    (*) in fish shell, IDK about bash</code></code>

    edit: It's not like I specifically want JSON output: any format will do (ideally, nix would be nice)

    2
    nixos @lemmy.ml gomp @lemmy.ml
    How to merge multiple `writeShellApplication` into a single package?

    I need to generate a number of scripts in my configuration and make them into a single package (for ease of reference, because there are a lot of them).

    So far, I'm creating the scripts via writeShellApplication, making them into packages via an overlay, merging them with buildEnv and then adding the resulting package to `systemPackages.

    Something like:

    ````nix nixpkgs.overlays = [ (final: prev: { my-hello-1 = final.writeShellApplication { name = "my-hello-1-script"; text = "echo my hello wolrd 1"; }; my-hello-2 = final.writeShellApplication { name = "my-hello-2-script"; text = "echo my hello wolrd 1"; }; my-hello-scripts = final.buildEnv { name = "my-hello-scripts"; paths = [ final.my-hello-1 final.my-hello-2 ]; }; }) ];

    environment.systemPackages = [ pkgs.my-hello-scripts ]; ````

    This works, but I don't really need the my-hello-1 and my-hello-2 packages... can you think of a way to make do without needing them?

    8
    nixos @lemmy.ml gomp @lemmy.ml
    Recommended way to generate scripts from configuration.nix?

    I'm migrating my NAS to nixos, and I got to the point of setting up my restic backups.

    services.restic.backups is great, but -- on top of the systemd timers/services -- I also want some helper scripts (eg. one to easily mount the backups, stuff that with ansible I currently generate into /usr/local/sbin).

    These scripts would be entirely generated from the services.restic.backups config and would reference sops secrets also from configuration.nix, so... I don't think it would make sense to make a package out of them?

    What should I use to make these scripts? Should I use nixpkgs.writeShellApplication and then alter the PATH?

    4
    Less-worst android brands?

    Since I need to run a few apps that won't work on LineageOS (because dumb developer security stance), I need to buy a "regular" android device that includes all the google "services".

    Ideally, it should be a cheap second-hand phone that will still receive security updates for a long time.

    Are there bands that are better (well, "less worse") than others from a privacy perspective?

    17
    gomp gomp @lemmy.ml
    Posts 18
    Comments 176